| « Optus supplied D-Link DSL-302G | The GPL Effect » |
Multiple IP addresses, single network adapter
I went to my Auntie's place yesturday to reinstall her machine (maybe Linux), and work out why her Internet isn't working.
Of course, she'd gone out and purchased a Compaq computer for 10 times more cost than a better custom job AND signed up for Optus ADSL.
Anyway, I needed to take a look at her ADSL modem at my home (see post Optus supplied D-Link DSL-302G for the reason). It's a D-Link DSL-302G, and it's default ip is 10.1.1.1 (class A). On my network, machines are in the address range 192.168.x.x (class C).
In the past I would have simply changed my IP address to something within that range so that I could access the device. I decided this time however, to look into allocating a SECOND IP, to my network card.
Follow up:
I knew in Linux, you could allocate a second address to an adapter, but until last night I had NO idea just how easy it actually is!
Here's all I did to give my network card, another IP in the class A range, so I could see the modem. First, this is my initial setup:
ifconfig
eth0 Link encap:Ethernet HWaddr 00:11:22:33:44:55
inet addr:192.168.0.22 Bcast:192.168.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7529682 errors:0 dropped:0 overruns:0 frame:0
TX packets:6698288 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1811041685 (1727.1 Mb) TX bytes:534013204 (509.2 Mb)
Interrupt:11 Base address:0x5000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:22641 errors:0 dropped:0 overruns:0 frame:0
TX packets:22641 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1269909 (1.2 Mb) TX bytes:1269909 (1.2 Mb)
So, my card is eth0. Now, I issue this command:
ifconfig eth0:0 inet 10.1.1.200 netmask 255.255.255.0
Nothing is returned, but now ifconfig should display the extra adapter (alias). Something like this:
eth0:0 Link encap:Ethernet HWaddr 00:11:22:33:44:55
inet addr:10.1.1.200 Bcast:10.255.255.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7530028 errors:0 dropped:0 overruns:0 frame:0
TX packets:6698403 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1811081648 (1727.1 Mb) TX bytes:534022959 (509.2 Mb)
Interrupt:11 Base address:0x5000
Most of the information displayed should be identical to the eth0 entry as it's just an alias.
Now you can use the name eth0:0 for some network tools that take a device as a parameter. For example, you can configure custom routes for this adapter using the parameter dev eth0:0.
To remove this interface alias, simply issue this command:
ifconfig eth0:0 del 10.1.1.200
OK, so WHY did I need access to this DSL-302G ADSL modem at my home? Check out Optus supplied D-Link DSL-302G.