wm: doc

ref: 9ca6d2be9980c59f0e94ca937a22d2513268d836
dir: /ipconfig.ms/

View raw version
Configuring a second interface to use the same IP stack:

First, check to ensure that both devices can be detected:

.P1
; ls '#l0'
'#l0/ether0'
; ls '#l1'
'#l1/ether1'
.P2

If the device cannot be detected, you will see:

.P1
; ls '#l2'
ls: #l2: no free devices
.P2

Next, bind the device to a new IP stack in /net.alt, then use ipconfig to add the address:

.P1
; bind -b '#l1' /net.alt
; bind -b '#I1' /net.alt
; ip/ipconfig -x /net.alt -g 198.51.100.1 ether /net.alt/ether1 add 198.51.100.2 255.255.255.0
.P2

Replace 198.51.100.1 with your actual default gateway, 198.51.100.2 with your public IP address, 255.255.255.0 with your subnet mask.

If configured properly, /net.alt/iproute should show routes similar to these:

.P1
; cat /net.alt/iproute
0.0.0.0         /96  198.51.100.1 4    none   0 198.51.100.0 /120
0.0.0.0         /96  198.51.100.1 4    none   0 198.51.100.2 /128
.P2

From another machine, ping the IP address 198.51.100.2:

.P1
another% ip/ping 198.51.100.2
.P2

Then, on the machine with 198.51.100.2, verify with snoopy that packets are received on the correct interface with correct ethernet and correct IP address:

.P1
cpu% snoopy -f 'icmp' /net.alt/ether1
after optimize: ether(ip(icmp))
001703 ms 
	ether(s=00907fa36c07 d=f2b2b3daeb64 pr=0800 ln=78)
	ip(s=172.56.234.40 d=198.51.100.2 id=0000 frag=0000 ttl=230 pr=1 ln=64)
	icmp(t=EchoReq c=0 ck=c851 id=d809 seq=2a65)
	dump(1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b)
002209 ms 
	ether(s=00907fa36c07 d=f2b2b3daeb64 pr=0800 ln=78)
	ip(s=172.56.234.40 d=198.51.100.2 id=0000 frag=0000 ttl=230 pr=1 ln=64)
	icmp(t=EchoReq c=0 ck=c850 id=d809 seq=2a66)
	dump(1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b)
.P2