Doug Crompton on 13 Oct 2010 19:37:01 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] Another network question


Question regarding multiple IP addresses on the same interface. This is on
an NSLU2 (which does not matter) using Debian Lenny

I want to assign two address ranges, one in 192.168.0.x and the other in
192.168.11.x ranges. The basic setup looks like this....


# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.78
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.10

dns-nameservers 192.168.0.2
dns-search example.org


I then added the 192.168.11.x with....

ifconfig eth0:1 up 192.168.11.0 netmask 255.255.255.0


and got......


LKG66450E:/home/doug# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:14:bf:66:45:0e
          inet addr:192.168.0.78  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::214:bfff:fe66:450e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:116879 errors:0 dropped:0 overruns:0 frame:0
          TX packets:101426 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:19413823 (18.5 MiB)  TX bytes:16806791 (16.0 MiB)

eth0:1    Link encap:Ethernet  HWaddr 00:14:bf:66:45:0e
          inet addr:192.168.11.78  Bcast:192.168.11.255
          Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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:177 errors:0 dropped:0 overruns:0 frame:0
          TX packets:177 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:17824 (17.4 KiB)  TX bytes:17824 (17.4 KiB)

LKG66450E:/home/doug# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use
Iface
localnet        *               255.255.255.0   U     0      0        0
eth0
192.168.11.0    *               255.255.255.0   U     0      0        0
eth0
default         192.168.0.10    0.0.0.0         UG    0      0        0
eth0


My question is can I have more than one default route. One associated with
the 192.168.0.x block and another associated with the 192.168.11.x block?
I want any traffic originating with IP addresses in the 192.168.11.x block
with a destination address outside of that range to go to 192.168.11.1
and originating traffic with an IP address in the 192.168.0.x range and
a destination outside of that range to go to 192.168.0.10


And why do I want to do this you ask? Well the NSLU2 only has console
connection via ethernet. If you you don't have connection via ethernet you
don't have any connection to the box. I want to take this between two
systems that are on different 192.168.x subnets. I don't want to have to
redefine another computers IP each time so I can change it. Perhaps there
is a better way or no way to do this. Just asking!

Doug





___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug