Operating System - Linux
1828798 Members
2444 Online
109985 Solutions
New Discussion

Routing details not found after restating network service on Debian

 
bullz
Super Advisor

Routing details not found after restating network service on Debian

Hello Dears,

OS:- Linux Debian 5.0
After restarting networking service /etc/init.d/networking, the existing routings are disappeared.

Then I manually added all the routing information by executing /etc/init.d/routes

1) Will the routing can be merged with networking script itself?
2) To achieve the point no 1, what are the changes need to be done?
2 REPLIES 2
Matti_Kurkela
Honored Contributor

Re: Routing details not found after restating network service on Debian

1.)
It can be merged to /etc/network/interfaces = the configuration file that controls all network interfaces. Run "man interfaces" to see more information.

2.)
Currently, your /etc/network/interfaces probably looks something like this:

[...]
iface eth0 inet static
address 1.2.3.4
netmask 255.255.255.0
gateway 1.2.3.1
[...]

Use the "up" keyword to add the necessary route commands:

[...]
iface eth0 inet static
address 1.2.3.4
netmask 255.255.255.0
gateway 1.2.3.1
up /etc/init.d/routes
[...]

Alternatively, you can use multiple lines with the "up" keyword and add all the route commands from /etc/init.d/routes to the /etc/network/interfaces file:

[...]
iface eth0 inet static
address 1.2.3.4
netmask 255.255.255.0
gateway 1.2.3.1
up route add -net 5.6.7.8 netmask 255.255.255.0 gw 1.2.3.66
up route add -net 9.0.1.2 netmask 255.255.255.0 gw 1.2.3.67
[...]

You can also use the newer "ip route add ..." command instead of the older "route add ...". This may be necessary if you need IPv6 or other advanced routing features.

MK
MK
bullz
Super Advisor

Re: Routing details not found after restating network service on Debian

Awesome, it works thanks