Changing default global IP gateway in CentOS 5.6
Changing default global IP gateway in CentOS 5.6
Hello everybody,
I need to change the global IP gateway in CentOS 5.6, i.e., the one chosen when no other more specific route is available.
Apparently, CentOS selects the gateway for the physical device with the highest index (in my case, eth3). But I want eth0.
I can only change it manually:
> route add default gw
> route del default gw
But I want to change it permanently (surviving reboots).
I have tried /etc/sysconfig/network-scripts/route-eth0 and NETWORK=0.0.0.0 with no success.
Any help would be appreciated.
Thank you.
Regards,
Jos?.
I need to change the global IP gateway in CentOS 5.6, i.e., the one chosen when no other more specific route is available.
Apparently, CentOS selects the gateway for the physical device with the highest index (in my case, eth3). But I want eth0.
I can only change it manually:
> route add default gw
> route del default gw
But I want to change it permanently (surviving reboots).
I have tried /etc/sysconfig/network-scripts/route-eth0 and NETWORK=0.0.0.0 with no success.
Any help would be appreciated.
Thank you.
Regards,
Jos?.
-
- Posts: 10642
- Joined: 2005/08/05 15:19:54
- Location: Northern Illinois, USA
Changing default global IP gateway in CentOS 5.6
Welcome to centOS.
New members should read:
http://www.centos.org/modules/newbb/viewforum.php?forum=47
Set "GATEWAY=XXX.XXX.XXX.XXX" in /etc/sysconfig/network.
New members should read:
http://www.centos.org/modules/newbb/viewforum.php?forum=47
Set "GATEWAY=XXX.XXX.XXX.XXX" in /etc/sysconfig/network.
Re: Changing default global IP gateway in CentOS 5.6
We already have that parameter in /etc/sysconfig/network, but unfortunately CentOS ignores it.
Re: Changing default global IP gateway in CentOS 5.6
Your clue was very helpful.
There was a profile called "default" (created by the DVD installer), and the interpreted network file was rather /etc/sysconfig/networking/profiles/default/network.
Once I have set GATEWAY there, the default gateway has been applied correctly.
Thank you very much.
There was a profile called "default" (created by the DVD installer), and the interpreted network file was rather /etc/sysconfig/networking/profiles/default/network.
Once I have set GATEWAY there, the default gateway has been applied correctly.
Thank you very much.
Re: Changing default global IP gateway in CentOS 5.6
The /etc/sysconfig/networking/* are probably created by "system-config-network" or equivalent. Pay attention to what files are symlinked and whether you could get rid of the /etc/sysconfig/networking/* entirely.
-
- Posts: 6
- Joined: 2014/01/03 22:55:41
- Location: Algiers
- Contact:
Re: Changing default global IP gateway in CentOS 5.6
Hi
I already chabge the value in /etc/sysconfig/networking/profiles/default/network but it s not woek for me
I already chabge the value in /etc/sysconfig/networking/profiles/default/network but it s not woek for me
Re: Changing default global IP gateway in CentOS 5.6
Please post the contents of /etc/sysconfig/network and also /etc/sysconfig/network-scripts/ifcfg-*
The 'network' file should work unless you also have GATEWAY= lines in the ifcfg files (which should be removed).
The 'network' file should work unless you also have GATEWAY= lines in the ifcfg files (which should be removed).
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
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
-
- Posts: 6
- Joined: 2014/01/03 22:55:41
- Location: Algiers
- Contact:
Re: Changing default global IP gateway in CentOS 5.6
Hi
My problem is resolved when I did this :
ifconfig eth0 ip 192.168.1.6 mask 255.255.255.0
route delete default gw 192.168.1.6 eth0
route add default gw 192.168.1.254 eth0
My problem is resolved when I did this :
ifconfig eth0 ip 192.168.1.6 mask 255.255.255.0
route delete default gw 192.168.1.6 eth0
route add default gw 192.168.1.254 eth0
Re: Changing default global IP gateway in CentOS 5.6
You really should not need to do this manually. As I requested before, please post the contents of /etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcfg-* and I am fairly sure we can fix this.
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
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
-
- Posts: 6
- Joined: 2014/01/03 22:55:41
- Location: Algiers
- Contact:
Re: Changing default global IP gateway in CentOS 5.6
now I have this in the configuration
[root@CENTOS6 ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=CENTOS6
[root@CENTOS6 ~]#
[root@CENTOS6 ~]# cat /etc/sysconfig/network-scripts/ifcfg-*
TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.1.195
PREFIX=24
GATEWAY=192.168.1.2
DNS1=8.8.8.8
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME=eth6
UUID=492b341a-b7c8-4c57-873c-e44b64b1f8e1
ONBOOT=yes
DEVICE=eth6
USERCTL=yes
HWADDR=00:0c:29:ea:81:40
NETMASK=255.255.255.0
DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
# If you're having problems with gated making 127.0.0.0/8 a martian,
# you can change this to something else (255.255.255.255, for example)
BROADCAST=127.255.255.255
ONBOOT=yes
NAME=loopback
[root@CENTOS6 ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=CENTOS6
[root@CENTOS6 ~]#
[root@CENTOS6 ~]# cat /etc/sysconfig/network-scripts/ifcfg-*
TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.1.195
PREFIX=24
GATEWAY=192.168.1.2
DNS1=8.8.8.8
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME=eth6
UUID=492b341a-b7c8-4c57-873c-e44b64b1f8e1
ONBOOT=yes
DEVICE=eth6
USERCTL=yes
HWADDR=00:0c:29:ea:81:40
NETMASK=255.255.255.0
DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
# If you're having problems with gated making 127.0.0.0/8 a martian,
# you can change this to something else (255.255.255.255, for example)
BROADCAST=127.255.255.255
ONBOOT=yes
NAME=loopback