Configuring CentOS for 2 NICs

Issues related to configuring your network
Post Reply
Iyengar
Posts: 33
Joined: 2005/09/23 13:34:25
Location: Middlesex County, MA, USA

Configuring CentOS for 2 NICs

Post by Iyengar » 2014/12/06 15:52:02

I am trying to configure my CentOS 5.11 server for 2 NICs.

the following is my ifcfg-eth0

# Intel Corporation 82573E Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
HWADDR=##:##:##:##:##:##
NETMASK=255.255.255.0
IPADDR=192.168.1.10
DNS1=127.0.0.1
DNS2=x.x.x.x
DNS3=x.x.x.y
DOMAIN=mydomain.org
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes


my ifcfg-eth1 looks like

# Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
HWADDR=##:##:##:##:##:##
NETMASK=255.255.255.0
IPADDR=10.1.1.10
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
DEFROUTE=no
DNS1=127.0.0.1
DNS2=10.25.250.252
DNS3=10.25.250.253
DOMAIN=mydomain.org
IPV4_FAILURE_FATAL=yes

the following is my /etc/sysconfig/network

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=myhost.mydomain.com
GATEWAY=192.168.1.1


With the above config, I am not able to connect to this server from any of other 10.x.x.x subnets. If I change the Gateway above to 10.1.1.1. then I can connect to and from all the 10.x.x.x subnets, but, I lose connectivity to my 192.168.x.x subnets. I also lose the SSH connectvity to the server from outside networks (My router with Internal IP 192.168.1.1) is configured to forward port 22 to 192.168.1.10. Any help with this is greatly appreciated..

Thanks in advance.

Iyengar

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: Configuring CentOS for 2 NICs

Post by gerald_clark » 2014/12/06 16:27:07

Your eth1 can only talk to the 10.1.1.0 network beacause of the 255.255.255.0 netmask.
You either need to change the netmask to 255.0.0.0 or use static routes.
Read the /usr/shar/doc/initscripts*/sysconfig.txt and lookup /etc/sysconfig/network-scripts/route-<interface-name>

Iyengar
Posts: 33
Joined: 2005/09/23 13:34:25
Location: Middlesex County, MA, USA

Re: Configuring CentOS for 2 NICs

Post by Iyengar » 2014/12/06 16:30:46

gerald_clark wrote:Your eth1 can only talk to the 10.1.1.0 network beacause of the 255.255.255.0 netmask.
You either need to change the netmask to 255.0.0.0 or use static routes.
Read the /usr/shar/doc/initscripts*/sysconfig.txt and lookup /etc/sysconfig/network-scripts/route-<interface-name>
Thanks for the pointers. changing the netmask did the trick (although I am still having problems with name resolution). I can connect with the IP address. Will I be compromising security by using the 255.0.0.0 netmask instead of using static routes?

Thanks,
Iyengar.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Configuring CentOS for 2 NICs

Post by TrevorH » 2014/12/06 17:10:14

Sounds like you need to use /etc/sysconfig/network-scripts/route-$interface files to tell it specific routes like

Code: Select all

10.2.0.0/16 via 10.1.1.1 dev eth1
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Iyengar
Posts: 33
Joined: 2005/09/23 13:34:25
Location: Middlesex County, MA, USA

Re: Configuring CentOS for 2 NICs

Post by Iyengar » 2014/12/07 15:10:36

TrevorH wrote:Sounds like you need to use /etc/sysconfig/network-scripts/route-$interface files to tell it specific routes like

Code: Select all

10.2.0.0/16 via 10.1.1.1 dev eth1
Thanks, Everything works well now. I was even able to figure out the problem with name resolution. Waiting on the chaps who maintain the DNS and Windows DCs to fix the problem. :-)

Post Reply