Sponsored Content
Full Discussion: Change Default gateway
Operating Systems Linux Red Hat Change Default gateway Post 302765387 by deljatt on Saturday 2nd of February 2013 06:44:33 AM
Old 02-02-2013
Change Default gateway

Hi..I have to change default gateway in my linux machine. Its OS is RHEL6.
I followed following steps.
1.run command ip route to check current default gateway
2.delete that gateway with command
route del default gw x.x.x.x eth2
3.Add new gatewy with command below
route add default gateway x.x.x.x eth0
4.Also ensure /etc/sysconfig/network has new gateway entry with eth name in it.
NETWORKING=yes
HOSTNAME=N1
GATEWAY=x.x.x.x
GATEWAYDEV=eth0

But when we restart network service it moves back to old gateway.

Kindly let me know how to make it permanent.

Thanks !!
 

9 More Discussions You Might Find Interesting

1. Solaris

How can I change the default gateway?

my actual default gatewas IP is: default 192.168.11.254 and I need to change it to 192.168.11.2, I'm using Solaris 9, how can i do it? and how i can save it in case that the machine restart and have the new default gateway IP saved? (5 Replies)
Discussion started by: Lestat
5 Replies

2. Shell Programming and Scripting

script to change default route when primary gateway dies

Hello all! We have two fedora routers one at each site. What we are trying to do worked using freesco but not on fedora, i'm not very good at scripting and need a little guidence. Basicly what we are trying to do is if the primary line dies, the router will change it's routes to go through our... (0 Replies)
Discussion started by: slacker
0 Replies

3. AIX

Help with Default Gateway

Hi, I have two interfaces on m AIX 5.3 box. One going to 192.168.1.x and it has a gateway of 192.168.1.1. I configured the other gateway with 192.168.2.x and the default gateway as 192.168.2.1. But I can't get connectivity to the 192.168.2.1 network. Can someone help me out and let me know... (7 Replies)
Discussion started by: bbbngowc
7 Replies

4. Solaris

Change gateway without reboot server

Hi Gurus Recently i had change the gateway for a server i had change the IP in the /etc/defaultrouter and run the below command # route add default 10.86.33.222 # route delete default 10.86.33.1 # netstat -rn Routing Table: IPv4 Destination Gateway Flags Ref ... (2 Replies)
Discussion started by: SmartAntz
2 Replies

5. HP-UX

where can i modify default gateway

where in configuration files can i modify default gateway in hp-ux11iv3 (5 Replies)
Discussion started by: h@foorsa.biz
5 Replies

6. Linux

GNUGK-How to setup static gateway to gateway routing

Dear Sir I am a newbie in the world of IP telephony. I have been working with Asterisk PBX (SIP) and Cisco Call Manager (MGCP) but now I am learning on how to work GNUGK for H.323 Gatekeeper. I am having a problem, configuring static call routing on GNUGK in the section ... (0 Replies)
Discussion started by: mfondoum
0 Replies

7. UNIX for Dummies Questions & Answers

Cannot ping default gateway

I have NCR MP-RAS unix. I have been trying for several months to get our network working since we had never used it before. I have setup all routes that I can think of. I know it has something to do with the routing table, because out of sheer luck I was able to get it working, and than like a... (4 Replies)
Discussion started by: Rutgerncas
4 Replies

8. IP Networking

Default Gateway

I am am using IPv6 IP's with an OS of Debian. Is it possible to set a *static* default gateway w/o the router being connected? Will that gateway change when the router is connected? TIA (0 Replies)
Discussion started by: Meow613
0 Replies

9. UNIX for Beginners Questions & Answers

Inconsistency between RedHat 6.5 global gateway and single gateway leads to loss of default gateway

Dear friends I use RedHat 6.5, which sets the gateway in the configuration file / etc / sysconfig / network as GATEWAY = 192.168.1.26, and the gateway in the configuration file / etc / sysconfig / network-scripts / ifcfg-eth11 as GATEWAY = 192.168.1.256. The two gateways are different.... (6 Replies)
Discussion started by: tanpeng
6 Replies
gateways(4)						     Kernel Interfaces Manual						       gateways(4)

NAME
gateways - Specifies Internet routing information to the routed daemon SYNOPSIS
/etc/gateways DESCRIPTION
The /etc/gateways file identifies gateways for the routed daemon. Ordinarily, the routed daemon queries the network and builds routing tables. The routed daemon builds the tables from routing information transmitted by other hosts directly connected to the network. How- ever, there may be gateways that this command cannot identify through its queries. These unidentified gateways are known as distant gate- ways. Such gateways should be identified in the /etc/gateways file, which the routed daemon reads when it starts. The general format of an file entry in the /etc/gateways file is: Destination Name1 gateway Name2 metric Value Type The following is a brief description of each element in an /etc/gateways file entry: A keyword that indicates whether the route is to a network or to a specific host. The two possible keywords are net and host. The name associated with Destination. Name1 can be either a symbolic name (as used in the /etc/hosts or /etc/networks file) or an Internet address specified in dotted-decimal format. An indicator that the following string identifies the gateway host. The name or address of the gateway host to which messages should be forwarded. An indicator that the next string represents the hop count to the destination host or network. The hop count, or number of gateways, from the local network to the destination network. A keyword that indicates whether the gateway should be treated as active, passive, or external. The three possible keywords are as follows: An active gateway is treated like a network interface. That is, it is expected to exchange RIP (Routing Information Protocol) routing information. Information about it is maintained in the internal routing tables as long as it is active and is included in any routing information that is transmitted through RIP. If it does not respond for a period of time, the route associated with it is deleted from the internal routing tables. A passive gateway is not expected to exchange RIP routing information. Information about it is maintained in the routing tables indefinitely and is included in any routing information that is transmitted through RIP. An external gateway is identified to inform the routed daemon that another routing process will install such a route and that alternative routes to that destination should not be installed. Information about external gateways is not maintained in the internal rout- ing tables and is not transmitted through RIP. Note that these routes must be to networks. EXAMPLES
To specify a route to a network through a gateway host with an entry in the gateways file, enter: net net2 gateway host4 metric 4 passive This example specifies a route to a network, net2, through the gateway host4. The hop count metric to net2 is 4, and the gateway is treated as passive. To specify a route to a host through a gateway host with an entry in the gateways file, enter: host host2 gate- way host4 metric 4 passive This example specifies a route to a host, host2, through the gateway host4. The hop count metric to host2 is 4, and the gateway is treated as passive. To specify a route to a host through an active Internet gateway with an entry in the gateways file, enter: host host10 gateway 192.100.11.5 metric 9 active This example specifies a route to a specific host, host10, through the gateway 192.100.11.5. The hop count metric to host10 is 9 and the gateway is treated as active. To specify a route to a host through a passive Internet gateway with an entry in the gateways file, enter: host host10 gateway 192.100.11.5 metric 9 passive This example specifies a route to a specific host, host10, through the gateway 192.100.11.5. The hop metric count to host10 is 9 and the gateway is treated as passive. To specify a route to a network through an external gateway, enter a line in the following format: net net5 gateway host7 metric 11 external This example specifies a route to a network, net5, through the gateway host7. The hop count metric to net5 is 11 and the gateway is treated as external (that is, it is not advertised through RIP, but is advertised through an unspecified routing protocol). RELATED INFORMATION
Daemons: gated(8), routed(8) delim off gateways(4)
All times are GMT -4. The time now is 07:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy