1829749 Members
1668 Online
109992 Solutions
New Discussion

Re: 2 Cards RedHat

 
castro_2
Regular Advisor

2 Cards RedHat

I have a RedHat 8.0 and 2 netowrk cards, the networks are diferents and the gateway. How can I do to set a diferent gateways for each card.
Thanks
9 REPLIES 9
Steven E. Protter
Exalted Contributor

Re: 2 Cards RedHat

There is a file that can be manipulated.

/etc/sysconfig/network-scripts

ifcfg-eth0 for the first card
ifcfg-eth1 for the second

The syntax is

gateway=ip_address

ip_address is numeric.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
castro_2
Regular Advisor

Re: 2 Cards RedHat

Thanks
But there is another file call network.
Steven E. Protter
Exalted Contributor

Re: 2 Cards RedHat

The files are in the directory I indicated.

When you finish the chagnes you can reset the network as follows:

service network restart

All existing connections will suspend for a few seconds.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Huc_1
Honored Contributor

Re: 2 Cards RedHat

edit /etc/sysconfig/network-scripts/ifcfg-eth0

and modify or add to suite your needs

GATEWAY=XX.XX.XX.XX

do the same for the second card.

edit /etc/sysconfig/network-scripts/ifcfg-eth1

Hope this helps.

J-P


Smile I will feel the difference
castro_2
Regular Advisor

Re: 2 Cards RedHat

I do this. But when I do a netstat -rn show me a only gateway.

Routing tables
Destination Gateway Flags Refs Iface Interface Pmtu
150.230.14.0 0.0.0.0 U eth0
150.230.16.0 0.0.0.0 U eth1
127.0.0.0 0.0.0.0 U lo
0.0.0.0 150.230.16.1 GW eth1

There is a another gateway 150.230.14.1
Thanks
Huc_1
Honored Contributor

Re: 2 Cards RedHat

Did you do a restart of service as SEP advised ?

That is as root do

#service network restart

!! please note this will stop and start network
for a few seconds !!

J-P
Smile I will feel the difference
Alexander Chuzhoy
Honored Contributor

Re: 2 Cards RedHat

the best way is to define a default gateway for one NIC. I mean trough this gateway you can go anywhere.
and instead of defining default gateway for second network use static routes.
There can be problem when there are 2 default gateways. The system doesn't always correctly handles it. I mean instead of using the apropriate Network card to get to a specific subnet , it can choose a wrong card.
Best regards.
castro_2
Regular Advisor

Re: 2 Cards RedHat

Yes, I restat the service #service network restart
and reboot the system.
How can I create a permanent static route?
Thanks
K.C. Chan
Trusted Contributor

Re: 2 Cards RedHat

Did you try taking out gateway on /etc/sysconfig/network and make sure each gateway is listed on /etc/sysconfig/network-scripts/ifcfg-eth[0|1] respectively. This may work or may not. Give it a try, provided you're still testing it and have not moved this into production.
Reputation of a thousand years can be determined by the conduct of an hour