Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to setup my ubuntu pc single nic card ip as 192.168.1.6 for internet and 10.172.170.95 and 135.10.86.100 for my lan and for another network through my 4port DSL modem.So i defined like this.

Except addition of last two routes(10.0.0.0/8 & 200.200.176.0/24) everything worked as defined, what is the mistake i did?

In /etc/network/interfaces file

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.1.6
netmask 255.255.255.0
gateway 192.168.1.1

In /etc/rc.local file

/sbin/ifconfig eth0:0 135.10.86.100 netmask 255.255.255.0
/sbin/ifconfig eth0:1 10.172.170.95 netmask 255.0.0.0.0
ip route add 10.0.0.0/8 via 10.172.170.6 src 10.172.170.95
ip route add 200.200.176.0/24 via 135.10.86.176 src 135.10.86.100

after restart, i found

ifconfig output as,

eth0      Link encap:Ethernet  HWaddr 00:11:82:87:12:4b  
          inet addr:192.168.1.6  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::221:85ff:fe96:441b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:760 errors:0 dropped:0 overruns:0 frame:0
          TX packets:576 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:417620 (417.6 KB)  TX bytes:93772 (93.7 KB)
          Interrupt:26 Base address:0xa000 

eth0:0    Link encap:Ethernet  HWaddr 00:11:82:87:12:4b  
          inet addr:135.10.86.100  Bcast:135.10.86.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:26 Base address:0xa000 

eth0:1    Link encap:Ethernet  HWaddr 00:11:82:87:12:4b  
          inet addr:10.172.170.95  Bcast:10.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:26 Base address:0xa000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:240 (240.0 B)  TX bytes:240 (240.0 B)

and route -n as,

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
135.10.86.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0
10.0.0.0        0.0.0.0         255.0.0.0       U     0      0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 eth0
share|improve this question

migrated from serverfault.com Jan 24 '10 at 17:33

This question came from our site for professional system and network administrators.

add comment

1 Answer

rc.local is not the best place to set up additional NIC aliases and routes.

Just use /etc/network/interfaces for that.

NIC alias example

static routes example

Concerning your problem:

you use an absolute path to the ifconfig tool, but a relative path to the ip tool. Try using an absolute path there too. Find it by using which ip or whereis ip.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.