Operating System - Linux
1833055 Members
2322 Online
110049 Solutions
New Discussion

Re: How to control ethxx gateway

 
SOLVED
Go to solution
Vernon Brown_4
Trusted Contributor

How to control ethxx gateway

I have a workstation with eth0 and eth1. Eth0 connects to a cable modem with internet access. Eth1 connects to a LAN router which has DSL internet access. I want to control which eth card is my gateway to internet access while keeping both eth cards active.



6 REPLIES 6
RAC_1
Honored Contributor

Re: How to control ethxx gateway

You need to set the default gateway. It should be in networks file in /etc/inet directory.
There is no substitute to HARDWORK
Steven E. Protter
Exalted Contributor
Solution

Re: How to control ethxx gateway

Vernon,

Add a statement to the config file.

/etc/sysconfig/network-scripts/ifcfg-eth0 or eth1

You really can't have two DEFAULT gateways, but but there is nothing that says you can't have gateway statements.

GATEWAY=192.168.0.15

Or whatever.

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
Steven E. Protter
Exalted Contributor

Re: How to control ethxx gateway

Whoops,

afterwards

service network restart

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
Gopi Sekar
Honored Contributor

Re: How to control ethxx gateway

if you are running redhat then edit /etc/sysconfig/network file and set GATEWAY= to your default gateway IP address.

Regards,
Gopi
Never Never Never Giveup
Vernon Brown_4
Trusted Contributor

Re: How to control ethxx gateway

Thanks guys ! !

The GATEWAY statement got it done.
Ross Minkov
Esteemed Contributor

Re: How to control ethxx gateway


/etc/sysconfig/static-routes -- defines the static routes that are non interface-specific.

/etc/sysconfig/network-scripts/route-eth? -- defines the interface specific static routes. (I think started with RHL9/RHEL3; before that all static routes were in /etc/sysconfig/static-routes)

-Ross