LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Duplicate GATEWAY statements, OK? (https://www.linuxquestions.org/questions/linux-networking-3/duplicate-gateway-statements-ok-894958/)

pgb205 08-01-2011 04:21 PM

Duplicate GATEWAY statements, OK?
 
I've been looking through ifcfg-ethX files on some of the servers and see that for a few I have GATEWAY=xxx.xxx.xxx.xxx statement in a few of them. I don't believe that's normal as upon reboot I will end up with duplicate GATEWAYS. Is this a correct statement that there should be only single GATEWAY= across all ifcfg-ethX files?

thanks

T3RM1NVT0R 08-01-2011 04:42 PM

@ Reply
 
Hi there,

Are you trying to say that you have different GATEWAY set different ifcfg-ethX files. If that is the case then it could be normal if you have different IPs set on those NICs and you want them to use different gateway to communicate. Example:

If you have two NICs and ifcfg-eth0 configured with IP 192.168.1.10 and you have set up the gateway to be 192.168.1.1. That means this ethernet device will use 192.168.1.1 to be the gateway. And the second NIC is configured with IP 172.16.1.10 and you have set up the gateway 172.16.1.1 then it is quite normal in case you have different gateway configured for them. If you are using forwarding/NATing and you have single gateway the above configuration will become false. Then you have to set the same gateway for both of them.

If you are trying to say that you have same GATEWAY set for different ifcfg-ethX files then also it can be true. Just vice-versa of above example.

baldy3105 08-02-2011 02:08 PM

You can have multiple GATEWAYS. A gateway is an IP router that provides access to remote networks. You can have a route to network 1 via GATEWAY1 and a route to network 2 via GATEWAY2. Not a problem.

A DEFAULT-GATEWAY is what it says, the last ditch attempt to get rid of packets for which there is no other route table match. Therefore you only get one. You can configure multiple DEFAULT-GATEWAYS but your system will typically use a set of criteria to pick one of them and stick with it.

So make sure you know which one you are referring to.


All times are GMT -5. The time now is 03:22 PM.