- 论坛徽章:
- 0
|
如何在freebsd上一块网卡绑定两个地址
偶的测试结果:
#ifconfig rl0 ip netmask 0xffffffff alias
- [i2era ~]#ifconfig rl0
- rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST>; mtu 1500
- inet 192.168.2.15 netmask 0xffffff00 broadcast 192.168.2.255
- inet 192.168.2.252 netmask 0xffffffff broadcast 192.168.2.252
- ether 00:0a:eb:12:ca:d6
- media: Ethernet autoselect (100baseTX <full-duplex>;)
- status: active
- [i2era ~]#netstat -nr
- Routing tables
- Internet:
- Destination Gateway Flags Refs Use Netif Expire
- default 192.168.2.1 UGSc 1 0 rl0
- 127.0.0.1 127.0.0.1 UH 0 0 lo0
- 192.168.2 link#2 UC 3 0 rl0
- 192.168.2.1 00:e0:4c:04:66:a3 UHLW 2 0 rl0 1051
- 192.168.2.12 00:e0:4c:48:c1:43 UHLW 0 181 rl0 009
- 192.168.2.252/32 link#2 UC 0 0 rl0
复制代码
在别人的机子(ip:192.168.2.12)上ping 192.168.2.252,
我在Freebsd(192.168.2.15 and 192.168.2.252)上用tcpdump抓包的结果:
- [i2era ~]#tcpdump -i rl0 icmp and src host 192.168.2.12
- tcpdump: listening on rl0
- Apr 11 12:00:26 i2era /kernel: rl0: promiscuous mode enabled
- 12:00:27.413040 192.168.2.12 >; 192.168.2.252: icmp: echo request
- 12:00:28.414527 192.168.2.12 >; 192.168.2.252: icmp: echo request
- 12:00:29.416020 192.168.2.12 >; 192.168.2.252: icmp: echo request
- 12:00:30.417569 192.168.2.12 >; 192.168.2.252: icmp: echo request
- ^C
- 16 packets received by filter
- 0 packets dropped by kernel
- Apr 11 12:00:31 i2era /kernel: rl0: promiscuous mode disabled
复制代码 |
|