LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-05-2019, 11:37 PM   #1
linjing
LQ Newbie
 
Registered: Dec 2019
Posts: 2

Rep: Reputation: Disabled
How to add direct routes(proto kernel scope link) to non-main table automatically


When I add an IP to interface,the kernel will add a direct route to main table,and if I delete the IP,the kernel will delete the direct route from main table.As follows:
Code:
root@template:~# ip addr add 192.168.10.1/24 dev eth2 
root@template:~# ip route show table main | grep 192.168.10
192.168.10.0/24 dev eth2 proto kernel scope link src 192.168.10.1 
root@template:~# ip addr del 192.168.10.1/24 dev eth2
root@template:~# ip route show table main | grep 192.168.10     
root@template:~#
If add another route table to /etc/iproute2/rt_tables,how to make the new table works like main table add/del direct route automatically?

Thanks!
 
Old 12-06-2019, 04:52 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
In the iproute2 documentation, I read
Quote:
the use of both ip address and ifconfig will cause the kernel to alter the local routing table (and usually the main routing table). For further documentation on how to manipulate the other routing tables, see the command description of ip route.
To me, this means that preferential treatment of the main table is hardcoded, and there is no way of extending this treatment to other tables.
 
Old 12-09-2019, 02:35 AM   #3
linjing
LQ Newbie
 
Registered: Dec 2019
Posts: 2

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
In the iproute2 documentation, I read

To me, this means that preferential treatment of the main table is hardcoded, and there is no way of extending this treatment to other tables.
OK,Thanks very much.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot add default route in another routing table unless scope link route is in main vincix Linux - Networking 6 01-24-2018 02:29 AM
(Scope of address) == (scope of variable) kaz2100 Programming 10 01-26-2014 10:54 PM
[SOLVED] iproute2 in Debian lenny adds routes to the main table instead of desired table donalbane Linux - Networking 3 03-28-2012 11:01 AM
Double Local Link (Scope:Link) IPv6 address on one interface BernardLinux Linux - Networking 0 09-08-2011 02:43 AM
scope of an object and global scope lucky6969b Programming 7 12-09-2005 09:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration