1. 程式人生 > 實用技巧 >網絡卡組播組

網絡卡組播組

root@focal2-2:~# netstat -gan
IPv6/IPv4 Group Memberships
Interface       RefCnt Group
--------------- ------ ---------------------
lo              1      224.0.0.1
ens3            1      224.0.0.5
ens3            1      224.0.0.1
lo              1      ff02::1
lo              1      ff01::1
ens3            
1 ff02::1:ff96:d442 ens3 2 ff02::1 ens3 1 ff01::1 root@focal2-2:~#

root@focal2-2:~# ifconfig -a | grep multicast
root@focal2-2:~# cat /boot/config-5.4.0-42-generic  | grep CONFIG_IP_MULTICAST
CONFIG_IP_MULTICAST=y
root@focal2-2:~# 
root@focal2-2:~# cat /boot/config-5.4
.0-42-generic | egrep 'CONFIG_IP_MULTICAST|CONFIG_NET_IPIP|CONFIG_IP_MROUTE' CONFIG_IP_MULTICAST=y CONFIG_NET_IPIP=m CONFIG_IP_MROUTE_COMMON=y CONFIG_IP_MROUTE=y CONFIG_IP_MROUTE_MULTIPLE_TABLES=y
root@focal2-2:~#  ip mroute
root@focal2-2:~#  more /proc/net/ip_mr_vif
Interface      BytesIn  PktsIn  BytesOut PktsOut Flags Local    Remote
root@focal2
-2:~#

root@focal2-2:~# ip link set ens3 multicast on
root@focal2-2:~# ifconfig -a | grep multicast
root@focal2-2:~# ifconfig -a | grep multicast
root@focal2-2:~# ip link set ens3 multicast on
root@focal2-2:~# ip link show ens3
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether fa:16:3e:96:d4:42 brd ff:ff:ff:ff:ff:ff
root@focal2-2:~# 
root@ubuntu:/home/ubuntu# ip link set  enahisic2i3  multicast on
root@ubuntu:/home/ubuntu# ip -d  link show enahisic2i3  | grep  multicast
root@ubuntu:/home/ubuntu# 

root@focal:/var/log/frr# tcpdump -i ens3   ip proto ospf  -env
tcpdump: listening on ens3, link-type EN10MB (Ethernet), capture size 262144 bytes
20:07:55.365256 fa:16:3e:07:4f:e6 > 01:00:5e:00:00:05, ethertype IPv4 (0x0800), length 78: (tos 0xc0, ttl 1, id 43803, offset 0, flags [none], proto OSPF (89), length 64)
    10.10.18.148 > 224.0.0.5: OSPFv2, Hello, length 44
        Router-ID 10.10.18.148, Backbone Area, Authentication Type: none (0)
        Options [External]
          Hello Timer 10s, Dead Timer 40s, Mask 255.255.255.0, Priority 1
20:08:05.365555 fa:16:3e:07:4f:e6 > 01:00:5e:00:00:05, ethertype IPv4 (0x0800), length 78: (tos 0xc0, ttl 1, id 43804, offset 0, flags [none], proto OSPF (89), length 64)
    10.10.18.148 > 224.0.0.5: OSPFv2, Hello, length 44
        Router-ID 10.10.18.148, Backbone Area, Authentication Type: none (0)
        Options [External]
          Hello Timer 10s, Dead Timer 40s, Mask 255.255.255.0, Priority 1
20:08:15.365867 fa:16:3e:07:4f:e6 > 01:00:5e:00:00:05, ethertype IPv4 (0x0800), length 78: (tos 0xc0, ttl 1, id 43805, offset 0, flags [none], proto OSPF (89), length 64)
    10.10.18.148 > 224.0.0.5: OSPFv2, Hello, length 44
        Router-ID 10.10.18.148, Backbone Area, Authentication Type: none (0)
        Options [External]
          Hello Timer 10s, Dead Timer 40s, Mask 255.255.255.0, Priority 1
^C
3 packets captured
3 packets received by filter
0 packets dropped by kernel
root@focal:/var/log/frr#