LinuxQuestions.org
Visit Jeremy's Blog.
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 06-11-2007, 10:06 AM   #1
yiux
LQ Newbie
 
Registered: Jan 2007
Location: Mauritius
Distribution: Debian 4.0R0
Posts: 11

Rep: Reputation: 0
static routes and ifconfig


am using debian 4.0 and when i use ifconfig to configure a network interface (static ip address). By doing this a static route is added automatically.

for example if--> # ifconfig eth0 192.168.1.2 netmask 255.255.255.0

then ---> # route -n
gives:
[HTML]Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.100.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0[/HTML]



i don't want this static route to be added automatically!!
Is there a way of doing this?!![HTML][/HTML]

Last edited by yiux; 06-11-2007 at 10:09 AM.
 
Old 06-11-2007, 11:17 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
that's your local interface, you can't not add it...
 
Old 06-11-2007, 12:12 PM   #3
yiux
LQ Newbie
 
Registered: Jan 2007
Location: Mauritius
Distribution: Debian 4.0R0
Posts: 11

Original Poster
Rep: Reputation: 0
In fact am using my linux box as a router and each time an interface is configured, it add a route automatically. I don't want to use this route, i want to use my own static route!!



Is there a way of preventing 'ifconfig' command from adding a route automatically!!
 
Old 06-11-2007, 12:32 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
as i said, there is no route, it's just a known interface with a subnet associated with it. rather than saying you want to do it your way, explain what problems this creates... if you, for some bizarre reason want a remote route to be preferred over a local connection you can always just use a higher metric for the local interface.
 
Old 06-11-2007, 06:24 PM   #5
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
If you don't want that route -n result, use a netmask of 255.255.255.255. Not that that is functional since you'll never be able to broadcast to any other interface it's connected to. If you truly had a route, your route -n would looks like this:

Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
0.0.0.0         192.168.2.1     0.0.0.0         UG    0      0        0 wlan0
The one with Gateway address is the actual route.
 
  


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
Problem with Static Routes kewlemer Linux - Networking 5 07-06-2006 01:18 AM
How do I config static routes? mikezang Linux - Networking 4 10-31-2005 10:29 AM
Max Static Routes? roundst Linux - Networking 2 07-28-2005 02:51 AM
automatic static routes? eantoranz Linux - Networking 5 07-19-2005 08:30 PM
static-routes in Mandrake 10.0 tallthom Mandriva 1 09-27-2004 12:51 AM

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

All times are GMT -5. The time now is 05:17 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