Version 3 (modified by stappers, 10 years ago) (diff)

IPalias

Networking is about understanding both ends of the line.

Most likely you came here from SmallSteps. So you have debwrt started with

qemu-system-mipsel -M malta -nographic \
  -kernel /usr/src/debwrt/build/openwrt-malta-le_Default-trunk-default/build_dir/linux-malta_le/vmlinux.elf \
  -hda /usr/src/debwrt/tile -parallel none -m 256 \
  -net user -net nic,model=pcnet \
  -append "root=/dev/sda1 probe_mask=0x3f init=/sbin/init root_delay=10"

That implies this network configuration (qemu defaults):

  • Address: 10.0.2.15
  • Netmask: 255.0.0.0
  • Router: 10.0.2.2
  • Name server: 10.0.2.3

Transforming that to your debwrt system is manual done with these commands

ifconfig eth0 10.0.2.15 netmask 255.0.0.0
route add default gw 10.0.2.2
echo nameserver 10.0.2.3 > /etc/resolv.conf

Making that configuration visible is done with

ifconfig eth0
netstat -r
cat /etc/resolv.conf

which looks like

root@debwrt:~# ifconfig eth0 10.0.2.15 netmask 255.0.0.0
root@debwrt:~# route add default gw 10.0.2.2
root@debwrt:~# echo nameserver 10.0.2.3 > /etc/resolv.conf
root@debwrt:~# 
root@debwrt:~# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 52:54:00:12:34:56  
          inet addr:10.0.2.15  Bcast:10.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:30 errors:0 dropped:0 overruns:0 frame:0
          TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4212 (4.1 KiB)  TX bytes:2568 (2.5 KiB)
          Interrupt:10 Base address:0x1020 

root@debwrt:~# netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
10.0.0.0        *               255.0.0.0       U         0 0          0 eth0
default         10.0.2.2        0.0.0.0         UG        0 0          0 eth0
root@debwrt:~# cat /etc/resolv.conf
nameserver 10.0.2.3
root@debwrt:~# 

Actual network traffic

wget -O NetworkingSteps.txt http://www.debwrt.net/trac/wiki/NetworkingSteps?format=txt

Will show

Resolving www.debwrt.net... 81.171.37.245
Connecting to www.debwrt.net|81.171.37.245|:80... connected.
HTTP request sent, awaiting response... 200 Ok
Length: 1965 [text/plain]
Saving to: `NetworkingSteps.txt'

Now you known that eth0 works.

host network reconfigure

Real debwrt devices have default the address 192.168.1.1. When your computer has addres example given 192.168.1.2 then you don't have to reconfigure your network.

If your computer has e.g. 172.24.0.21 you can avoid reconfigure by using an IP-alias. It is done by this command

sudo ifconfig eth0:1 192.168.1.2

Checking the host computer network configuration starts no with these commands

/sbin/ifconfig eth0
/sbin/ifconfig eth0:1

will show

eth0      Link encap:Ethernet  HWaddr 00:22:15:fd:e4:13  
          inet addr:172.24.0.21  Bcast:172.24.0.63  Mask:255.255.255.192
          inet6 addr: fe80::222:15ff:fefd:e413/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4282 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2207 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:331645 (323.8 KiB)  TX bytes:410611 (400.9 KiB)

eth0:1    Link encap:Ethernet  HWaddr 00:22:15:fd:e4:13  
          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

Your desktop computer is now in two IPv4 networks.

See Also

NetConsole