Date: Sat, 14 Dec 1996 11:29:28 -0100 From: Darius Moos <moos@webmore.com> To: Charles Henrich <henrich@crh.cl.msu.edu> Cc: freebsd-hackers@FreeBSD.org Subject: Re: Intelligent source IP's in multinet singlephysicalnet connections? Message-ID: <3.0.32.19961214112917.00697814@cyclone.degnet.baynet.de>
next in thread | raw e-mail | index | archive | help
Hi Charles, what you are trying to do definately works !!! I'll show it to you now. 1. Two FreeBSD-boxes. FreeBSD-2.1.5 <--------- ethernet (ed0) -----------------> FreeBSD-1.1.5.1 192.168.250.5 netmask 0xfffffff8 | 192.168.250.1 netmask 0xfffffff8 192.168.250.2 alias netmask 0xffffffff | 10.0.0.2 alias netmask 0xffffff00 10.0.0.1 alias netmask 0xffffff00 | 2. At bootup the 10.0.0.x alias adr.es are NOT assigned. I'll do it in the session. 3. Now please read the session carefully and right to the end. What are the IP-adr.es and domain-names (parts of the tcpdump-output are with domain-names, so the following is for clarifying): neuron:~> nslookup neuron Server: neuron.bsd.uni-passau.de Address: 192.168.250.5 Name: neuron.bsd.uni-passau.de Address: 192.168.250.5 neuron:~> nslookup vampire Server: neuron.bsd.uni-passau.de Address: 192.168.250.5 Name: vampire.bsd.uni-passau.de Address: 192.168.250.1 Now the routing-tabel for 192.168.250.5 after bootup: neuron:/usr/home/moos# netstat -rn Routing tables Internet: Destination Gateway Flags Refs Use Netif Expire 127 127.0.0.1 URc 0 0 lo0 127.0.0.1 127.0.0.1 UH 10 31 lo0 192.168.250/29 link#1 UC 0 0 192.168.250.1 0:0:44:3:be:2b UHLW 10 337 ed0 1067 192.168.250.2 0:0:44:5:e2:50 UHLW 0 0 lo0 => 192.168.250.2/32 link#1 UC 0 0 192.168.250.5 0:0:44:5:e2:50 UHLW 1 44 lo0 224.0.0.9 127.0.0.1 UH 0 0 lo0 Routing-table for 192.168.250.1 after bootup: vampire:~> netstat -rn Routing tables Destination Gateway Flags Refs Use IfaceMTU Rtt Netmasks: (root node) (0) 0000 ffff fff8 (root node) Route Tree for Protocol Family inet: (root node) => default 192.168.250.5 UG 1 126 ed0 - - 127.0.0.1 127.0.0.1 UH 1 0 lo0 - - 192.168.250 192.168.250.1 U 9 247 ed0 - - 192.168.250.1 127.0.0.1 UGH 6 123 lo0 - - 192.168.250.2 192.168.250.5 UGH 0 0 ed0 - - (root node) Now the IP-aliasing: neuron:/usr/home/moos# ifconfig ed0 inet 10.0.0.1 netmask 0xffffff00 alias vampire:/mount/neuron/usr/home/moos# ifconfig ed0 inet 10.0.0.2 netmask 0xffffff00 alias Verifying that the alias worked for 192.168.250.5 (alias 10.0.0.1): neuron:/usr/home/moos# ping 10.0.0.2 PING 10.0.0.2 (10.0.0.2): 56 data bytes 64 bytes from 10.0.0.2: icmp_seq=0 ttl=255 time=1.737 ms 64 bytes from 10.0.0.2: icmp_seq=1 ttl=255 time=0.893 ms ^C --- 10.0.0.2 ping statistics --- 2 packets transmitted, 2 packets received, 0% packet loss round-trip min/avg/max = 0.893/1.315/1.737 ms neuron:/usr/home/moos# netstat -rn Routing tables Internet: Destination Gateway Flags Refs Use Netif Expire 10/24 link#1 UC 0 0 10 192.168.250.1 UGc 0 0 ed0 10.0.0.2 0:0:44:3:be:2b UHLW 0 2 ed0 1181 127 127.0.0.1 URc 0 0 lo0 127.0.0.1 127.0.0.1 UH 10 31 lo0 192.168.250/29 link#1 UC 0 0 192.168.250.1 0:0:44:3:be:2b UHLW 11 653 ed0 813 192.168.250.2 0:0:44:5:e2:50 UHLW 0 0 lo0 => 192.168.250.2/32 link#1 UC 0 0 192.168.250.5 0:0:44:5:e2:50 UHLW 2 69 lo0 224.0.0.9 127.0.0.1 UH 0 0 lo0 Verifying that the alias worked for 192.168.250.1 (alias 10.0.0.2): vampire:/mount/neuron/usr/home/moos# netstat -rn Routing tables Destination Gateway Flags Refs Use IfaceMTU Rtt Netmasks: (root node) (0) 0000 ffff ff00 (0) 0000 ffff fff8 (root node) Route Tree for Protocol Family inet: (root node) => default 192.168.250.5 UG 1 270 ed0 - - 10 10.0.0.2 U 1 4 ed0 - - 127.0.0.1 127.0.0.1 UH 1 0 lo0 - - 192.168.250 192.168.250.1 U 9 729 ed0 - - 192.168.250.1 127.0.0.1 UGH 2 153 lo0 - - 192.168.250.2 192.168.250.5 UGH 0 0 ed0 - - (root node) Now making a telnet-session: neuron:~> telnet 10.0.0.2 Trying 10.0.0.2... Connected to 10.0.0.2. Escape character is '^]'. FreeBSD (vampire.bsd.uni-passau.de) (ttyp1) login: The tcpdump-output for this telnet-connection: 10:43:43.191331 arp who-has 10.0.0.1 tell 10.0.0.1 10:43:43.205452 10.0.0.1.router > 10.0.0.255.router: rip-req 24 [ttl 1] 10:43:43.205842 10.0.0.1.router > 10.0.0.255.router: rip-resp 1: 192.168.250.2(1) [ttl 1] ... 10:43:56.650242 10.0.0.1.router > 10.0.0.255.router: rip-resp 1: 192.168.250.2(1) [ttl 1] ... 10:44:54.748619 arp who-has 10.0.0.2 tell 10.0.0.1 10:44:54.749218 arp reply 10.0.0.2 is-at 0:0:44:3:be:2b 10:44:54.749367 10.0.0.1 > 10.0.0.2: icmp: echo request 10:44:54.749984 10.0.0.2 > 10.0.0.1: icmp: echo reply 10:44:55.750215 10.0.0.1 > 10.0.0.2: icmp: echo request 10:44:55.750820 10.0.0.2 > 10.0.0.1: icmp: echo reply 10:44:56.650277 10.0.0.1.router > 10.0.0.255.router: rip-resp 1: 192.168.250.2(1) [ttl 1] ... 10:45:26.650248 10.0.0.1.router > 10.0.0.255.router: rip-resp 1: 192.168.250.2(1) [ttl 1] ... 10:45:56.650693 10.0.0.1.router > 10.0.0.255.router: rip-resp 1: 192.168.250.2(1) [ttl 1] ... 10:46:15.036308 10.0.0.1.1037 > 10.0.0.2.telnet: . ack 1 win 17520 (DF) [tos 0x10] 10:46:15.038426 10.0.0.1.1037 > 10.0.0.2.telnet: P 1:28(27) ack 1 win 17520 (DF) [tos 0x10] 10:46:15.039001 10.0.0.2.telnet > 10.0.0.1.1037: . ack 28 win 16033 ... 10:46:26.650263 10.0.0.1.router > 10.0.0.255.router: rip-resp 1: 192.168.250.2(1) [ttl 1] ... 10:46:56.650249 10.0.0.1.router > 10.0.0.255.router: rip-resp 1: 192.168.250.2(1) [ttl 1] ... 10:47:26.650263 10.0.0.1.router > 10.0.0.255.router: rip-resp 1: 192.168.250.2(1) [ttl 1] ... 10:47:30.234997 10.0.0.2.telnet > 10.0.0.1.1037: P 1:13(12) ack 28 win 16033 [tos 0x10] 10:47:30.235495 10.0.0.1.1037 > 10.0.0.2.telnet: P 28:31(3) ack 13 win 17520 (DF) [tos 0x10] 10:47:30.236256 10.0.0.2.telnet > 10.0.0.1.1037: P 13:31(18) ack 31 win 16057 [tos 0x10] 10:47:30.237059 10.0.0.1.1037 > 10.0.0.2.telnet: P 31:40(9) ack 31 win 17520 (DF) [tos 0x10] 10:47:30.237670 10.0.0.2.telnet > 10.0.0.1.1037: P 31:49(18) ack 40 win 16051 [tos 0x10] 10:47:30.242244 10.0.0.1.1037 > 10.0.0.2.telnet: P 40:100(60) ack 49 win 17520 (DF) [tos 0x10] 10:47:30.242957 10.0.0.2.telnet > 10.0.0.1.1037: . ack 100 win 16000 [tos 0x10] 10:47:30.256849 10.0.0.2.telnet > 10.0.0.1.1037: P 49:52(3) ack 100 win 16060 [tos 0x10] 10:47:30.257153 10.0.0.1.1037 > 10.0.0.2.telnet: P 100:103(3) ack 52 win 17520 (DF) [tos 0x10] 10:47:30.257813 10.0.0.2.telnet > 10.0.0.1.1037: . ack 103 win 16057 [tos 0x10] 10:47:30.262996 10.0.0.2.telnet > 10.0.0.1.1037: P 52:107(55) ack 103 win 16060 [tos 0x10] 10:47:30.263411 10.0.0.1.1037 > 10.0.0.2.telnet: P 103:106(3) ack 107 win 17520 (DF) [tos 0x10] 10:47:30.264039 10.0.0.2.telnet > 10.0.0.1.1037: . ack 106 win 16057 [tos 0x10] 10:47:30.270898 10.0.0.2.telnet > 10.0.0.1.1037: P 107:113(6) ack 106 win 16060 [tos 0x10] 10:47:30.430115 10.0.0.1.1037 > 10.0.0.2.telnet: . ack 113 win 17520 (DF) [tos 0x10] 10:47:30.431090 10.0.0.2.telnet > 10.0.0.1.1037: P 113:126(13) ack 106 win 16060 [tos 0x10] 10:47:30.630119 10.0.0.1.1037 > 10.0.0.2.telnet: . ack 126 win 17520 (DF) [tos 0x10] ... 10:47:49.445254 10.0.0.1.1037 > 10.0.0.2.telnet: P 106:107(1) ack 126 win 17520 (DF) [tos 0x10] 10:47:49.445836 10.0.0.2.telnet > 10.0.0.1.1037: . ack 107 win 16059 [tos 0x10] 10:47:49.453783 10.0.0.2.telnet > 10.0.0.1.1037: F 126:126(0) ack 107 win 16059 [tos 0x10] 10:47:49.453950 10.0.0.1.1037 > 10.0.0.2.telnet: . ack 127 win 17520 (DF) [tos 0x10] 10:47:49.454322 10.0.0.1.1037 > 10.0.0.2.telnet: F 107:107(0) ack 127 win 17520 (DF) [tos 0x10] 10:47:49.454873 10.0.0.2.telnet > 10.0.0.1.1037: . ack 108 win 16058 [tos 0x10] ... 10:47:56.650267 10.0.0.1.router > 10.0.0.255.router: rip-resp 1: 192.168.250.2(1) [ttl 1] Now a telnet-session with the 192.168.250.x-block: neuron:~> telnet 192.168.250.1 Trying 192.168.250.1... Connected to 192.168.250.1. Escape character is '^]'. FreeBSD (vampire.bsd.uni-passau.de) (ttyp1) login: Connection closed by foreign host. neuron:~> And the tcpdump-output for it: 10:51:10.002743 neuron.bsd.uni-passau.de.1038 > vampire.bsd.uni-passau.de.telnet: S 94016001:94016001(0) win 16384 <mss 1460,nop,wscale 0,nop,nop,timestamp| (DF) [tos 0x10] 10:51:10.003859 vampire.bsd.uni-passau.de.telnet > neuron.bsd.uni-passau.de.1038: S 100864001:100864001(0) ack 94016002 win 16060 <mss 1460> 10:51:10.004080 neuron.bsd.uni-passau.de.1038 > vampire.bsd.uni-passau.de.telnet: . ack 1 win 17520 (DF) [tos 0x10] 10:51:10.005492 neuron.bsd.uni-passau.de.1038 > vampire.bsd.uni-passau.de.telnet: P 1:28(27) ack 1 win 17520 (DF) [tos 0x10] 10:51:10.006108 vampire.bsd.uni-passau.de.telnet > neuron.bsd.uni-passau.de.1038: . ack 28 win 16033 10:51:10.082834 vampire.bsd.uni-passau.de.telnet > neuron.bsd.uni-passau.de.1038: P 1:13(12) ack 28 win 16033 [tos 0x10] 10:51:10.083262 neuron.bsd.uni-passau.de.1038 > vampire.bsd.uni-passau.de.telnet: P 28:31(3) ack 13 win 17520 (DF) [tos 0x10] 10:51:10.084065 vampire.bsd.uni-passau.de.telnet > neuron.bsd.uni-passau.de.1038: P 13:31(18) ack 31 win 16057 [tos 0x10] 10:51:10.084740 neuron.bsd.uni-passau.de.1038 > vampire.bsd.uni-passau.de.telnet: P 31:40(9) ack 31 win 17520 (DF) [tos 0x10] 10:51:10.085370 vampire.bsd.uni-passau.de.telnet > neuron.bsd.uni-passau.de.1038: P 31:49(18) ack 40 win 16051 [tos 0x10] 10:51:10.089673 neuron.bsd.uni-passau.de.1038 > vampire.bsd.uni-passau.de.telnet: P 40:100(60) ack 49 win 17520 (DF) [tos 0x10] 10:51:10.090371 vampire.bsd.uni-passau.de.telnet > neuron.bsd.uni-passau.de.1038: . ack 100 win 16000 [tos 0x10] 10:51:10.103909 vampire.bsd.uni-passau.de.telnet > neuron.bsd.uni-passau.de.1038: P 49:52(3) ack 100 win 16060 [tos 0x10] 10:51:10.104214 neuron.bsd.uni-passau.de.1038 > vampire.bsd.uni-passau.de.telnet: P 100:103(3) ack 52 win 17520 (DF) [tos 0x10] 10:51:10.104886 vampire.bsd.uni-passau.de.telnet > neuron.bsd.uni-passau.de.1038: . ack 103 win 16057 [tos 0x10] 10:51:10.110191 vampire.bsd.uni-passau.de.telnet > neuron.bsd.uni-passau.de.1038: P 52:107(55) ack 103 win 16060 [tos 0x10] 10:51:10.110607 neuron.bsd.uni-passau.de.1038 > vampire.bsd.uni-passau.de.telnet: P 103:106(3) ack 107 win 17520 (DF) [tos 0x10] 10:51:10.111250 vampire.bsd.uni-passau.de.telnet > neuron.bsd.uni-passau.de.1038: . ack 106 win 16057 [tos 0x10] Conclusion: ----------- Depending on the dest-net-adr the src-adr is set accordingly. Was it that what you wanted to do? Maybe i misunderstood something in your problem-description. Darius Moos. At 05:33 10.12.96 -0500, you wrote: >> Some months ago i tried this with FreeBSD-2.1.5 and it worked. I've >> checked it with bpf. When you have defined an alias-adr on your >> network-card, and you are sending packets to the network the alias-adr. >> lives in, the src-ip-adr is set to this alias-adr. > >I think you just got lucky, as it doesnt do this on any system of mine 2.1.x or >2.2.x, and one of the developers had told me some time ago they patched it in >2.2. > >-Crh > > Charles Henrich Michigan State University henrich@msu.edu > > http://pilot.msu.edu/~henrich > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3.0.32.19961214112917.00697814>