LinuxQuestions.org
Register a domain and help support LQ
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 08-17-2011, 05:03 PM   #1
gleemer
LQ Newbie
 
Registered: Aug 2011
Posts: 3

Rep: Reputation: Disabled
Question "ip route flush table main" doesn't work correctly from rc.local?


Ubuntu Server 10.10

/etc/rc.local is running a script which starts like this:

Code:
ip route flush table main # clears any unwanted default routes
The problem is for whatever reason this does not clear routes for interfaces configured to use DHCP. My first thought was that either the DHCP routes aren't in MAIN, or I was being protected from breaking my route to the DHCP server. However if I log into the machine and type the same flush command manually the routes for the DHCP interfaces do disappear.

The only way this makes sense to me is if rc.local is being executed before those routes are being written to the table. But as I understand things rc.local is among the last things done in the boot process...so that doesn't really make sense. What is going on here?


If it helps this script is for an oddball appliance I am building. In many scenarios the appliance will have two or more interfaces on the same subnet. One interface will act as the gateway and have

Code:
default via $GW dev $ADMIN_IFACE
SU.BN.ET.IP/24 dev $ADMIN_IFACE  proto kernel  scope link  src $ADMIN_IP
for its routes. Any other interfaces on that subnet will have only a single route to a single IP address. Whether any of the interfaces are DHCP or static will vary machine to machine and is out of my control.

The rest of the script after, the "ip route flush" command builds the routing table that I need then applies a firewall. An alternate question to the "what is going on here?" is, is there someway for me to control the default routes linux creates so I don't have to flush and build my own every boot?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Does mounting HDD with "flush" & "sync" have any real use? Mr. Alex Linux - Hardware 1 02-03-2011 03:46 AM
C++ - "snprintf" inside "for" doesn't work as expected. (int to char*) Repgahroll Programming 14 08-31-2010 08:27 AM
mysql "flush logs" or "flush tables with read lock", ... hangs deadeyes Linux - Server 4 01-19-2010 03:24 AM
pwmconfig correctly detects fans but "test" doesn't work...? shock_ez Linux - Software 0 05-07-2009 10:35 AM
the "applications" gnome main menu doesn't work htamayo Debian 1 10-28-2008 03:51 PM


All times are GMT -5. The time now is 01:02 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration