GATEWAY in ifcfg-eth0, does it have a purpose?
I'm wondering what is the purpose of the GATEWAY entries in the ifcfg-xxx files as they don't seem to be used to add any gateway or route either after a network restart or a reboot.(using REDHAT ES4)
I have added GATEWAY entries to ifcfg-bond0, ifconfig-bond0:0 etc... but these entries don't seem to be used, as per netstat -rn output. In order to apply a persistent gateway I added a static route to the rc.local and a default gateway to the /etc/sysconfig/network file. 1) rc.local requires a reboot 2) whereas the network file addition just requires a network service restart. any comments would be welcome |
I would post the info pretaining to the eth0 bond0 bond0:0 items and anything else in there related to ifcfg-xxxx. Now not sure on gateway on the bond stuff. gateway unless routing commands are enabled it is best to have only one file use the gateway option. Like in masquerading I set the Internet nic with gateway and for the lan nic I only set IP and subnet. Setting gateway on the lan interfaces causes problems. IP masquerading handles this routing for you this way.
Brian |
Thanks for the reply but I'm not sure I understand the answer to the GATEWAY issue.
If I add "GATEWAY=192.62.108.1" then restart network service or even reboot, there is no gateway listed in netstat -rn output. So I'm wondering what is missing, or why put the GATEWAY parameter in the file at all. Surely I must be missing some configuration or script that reads/loads the gateway form the ifcfg-eth0 file. PS. I remedy this by adding a default gateway to the /etc/sysconfig/network file or a static route. But I'm puzzled over the purpose of the gateway setting in the ifcfg... file. Steve. |
Need to see those related files contents to try to make sense as to what you have setup already.
Brian |
Thanks for the reply,
Actually my question is more general as I HAVE ALREADY added a gateway and static route via the 'network' file and the 'rc.local' file, but I don't know what script should NORMALLY pick up the GATEWAY from the ifconfig-eth0 file. (in general). This setting seems to have no purpose on systems I have looked at. I think there must be a script somewhere that SHOULD read the GATEWAY FOR THE interface and call a 'route add' command in a shell. An example ifconfig-eth0 file is below. DEVICE=eth0 BOOTPROTO=none ONBOOT=yes NETWORK=10.0.1.0 NETMASK=255.255.255.0 IPADDR=10.0.1.27 GATEWAY=10.0.1.1 USERCTL=no |
bond inteface may not even use any thing but a few lines like described here for channel bonding on the same network class.
http://www.redhat.com/docs/manuals/e...NTERFACES-CHAN Brian |
I too have noticed that, but I am aware that it DOES make a difference. No GATEWAY = packets don't know where there next hop is. They really should implement a feature that allows you to change your gateway via the command line like just about every other interface option...
|
Out of ideas.
brian |
Hi Brian, thanks for the link.. I'll take a look
Hi edclancy7715, I'm not talking about the PURPOSE of a gateway per se, actually I am talking about whether or not the line 'GATEWAY=' is read/used by any script. If I add this line GATEWAY=XX.XX.XX.XX in any of the installations I have access to then restart network/or reboot!!, calling 'netstat -rn' there is NO GATEWAY for any routes, so the setting is NOT USED to configure the interface! |
Maybe it is just my installations, but if anyone can please confirm on their own installation. If they add the line:
GATEWAY=XX.XX.XX.XX to their ifconfig-eth0 file, restart network, is there a gateway listed in their 'netstat -rn' output. For me, the settings is not picked up. |
there is certainly no *point* in putting that line in there, as it's the /etc/sysconfig/network file that holds the system wide gateway. it's the /sbin/ifup scripts which processes this, and it suggests it is going to use that if there is no other one in a better location. just read that scritp and answer your own question i guess.
|
Chris,
you said: "there is certainly no *point* in putting that line in there, as it's the /etc/sysconfig/network file that holds the system wide gateway." 1) well actually there is a *point* as I said and IN FACT you said yourself(I AM defining a default gateway!!) which is what you say in your next sentence.. 2) well my question is NOT about this network file...AT ALL ... my question is WHAT reads the GATEWAY line from the ifconfig-eth0 file.. because if I define a gateway in this file, NOTHING seems to read it... as per output of netstat -rn. (and others have told me similar things) thankyou to yourself and others for your comments. But I've tried to explain and re-explain the question.. it seems no-one understands what I'm asking...that's ok.... I guess I'll work it out |
cutoff.... But as you suggest.... and look at the ifup script.. and maybe I will be able to post my own answer.
|
1) no there is no point as the more conventional place it the /etc/sysconfig/network script as i already said.
2) the ifup script reads it, as i also already said. |
Hi Chris,
There are 3 of us reading this post and we all thought that with "'in there' and 'it'" you were saying it is no point to put the GATEWAY in (there) = ""../network file'."" My question doesn't relate to 'convention' but I think it's best just to drop the issue, because we seem to be getting confused here. thanks anyway. have a nice day. |
All times are GMT -5. The time now is 08:59 AM. |