Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Sun Aug 20, 2017 4:46 am


Cisco / Juniper related articles

Author Message
debuser
Post  Post subject: Changing default route in Linux Redhat/Debian  |  Posted: Fri Jun 11, 2010 10:56 am

Joined: Thu Aug 06, 2009 2:48 am
Posts: 105

Offline
 

Changing default route in Linux Redhat/Debian

When having IP aliases on one interface, by default, the kernel will choose the main IP as a source. Example:

Code:
server# ip a l bond1
3: bond1: <BROADCAST,MULTICAST,MASTER,UP> mtu 1500 qdisc noqueue
    link/ether 00:0e:0c:6f:25:a1 brd ff:ff:ff:ff:ff:ff
    inet 168.22.13.11/24 brd 172.22.11.255 scope global bond1
    inet 168.22.13.15/32 scope global bond1
server# ip ro get 10.1.1.1
10.1.1.1 via 168.22.13.254 dev bond1  src 168.22.13.11
    cache  mtu 1500 advmss 1460 hoplimit 64


Changing a route (in this case, default one)on a Linux systems with multiple IP addresses per interface can be done with following command:
Code:
server# ip ro change default via 168.22.13.254 src 168.22.13.15
server# ip ro get 10.1.1.1
10.1.1.1 via 168.22.13.254 dev bond1  src 168.22.13.15
    cache  mtu 1500 advmss 1460 hoplimit 64


Changing it back to previous state is the same, without the "src" part:
Code:
server# ip ro change default via 168.22.13.254 src 168.22.13.15





Top
Display posts from previous:  Sort by  
Print view
Who is online
Users browsing this forum: No registered users and 0 guests
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
cronNews News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO