Record a Multicast DNS (mdns) problem-(ifconfig in linux), mdnsifconfig
Preface:Recently, the problem of mdns query has been fixed. The problem can be summarized into three parts, which are basic issues:
1. Gateway ifconfig query address
2. encoding of multiple programs occupying one port at the same time
3. mdns protocol and source code
Mdns is a protocol used for LAN discovery. For the linux system mounted by the gateway, you must first determine the address used for communication and describe the simplest command: ifconfig, although I have known this command for a long time, it actually contains a lot of basic knowledge.
Use the openwrt router I used to input ifconfig:
br-lan Link encap:Ethernet HWaddr 04:A1:51:9A:03:67 inet addr:198.100.100.1 Bcast:198.100.100.255 Mask:255.255.255.0 inet6 addr: fdbb:e076:9029::1/60 Scope:Global inet6 addr: fe80::6a1:51ff:fe9a:367/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:37358673 errors:0 dropped:0 overruns:0 frame:0 TX packets:49805372 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:10001210378 (9.3 GiB) TX bytes:49536338006 (46.1 GiB)eth0 Link encap:Ethernet HWaddr BE:7F:7D:5D:09:D9 inet6 addr: fe80::bc7f:7dff:fe5d:9d9/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:71274265 errors:0 dropped:0 overruns:383 frame:0 TX packets:67972711 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:23375869 (22.2 MiB) TX bytes:4047624223 (3.7 GiB) Interrupt:4 eth0.1 Link encap:Ethernet HWaddr BE:7F:7D:5D:09:D9 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:27485423 errors:0 dropped:0 overruns:0 frame:0 TX packets:32246955 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:8388027931 (7.8 GiB) TX bytes:32142311436 (29.9 GiB)eth0.2 Link encap:Ethernet HWaddr 04:A1:51:9A:03:68 inet addr:193.168.1.125 Bcast:193.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::6a1:51ff:fe9a:368/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:43788842 errors:0 dropped:0 overruns:0 frame:0 TX packets:35727507 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:46186987470 (43.0 GiB) TX bytes:10288278423 (9.5 GiB)lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:10489 errors:0 dropped:0 overruns:0 frame:0 TX packets:10489 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1066479 (1.0 MiB) TX bytes:1066479 (1.0 MiB)wlan0 Link encap:Ethernet HWaddr 04:A1:51:9A:03:67 inet6 addr: fe80::6a1:51ff:fe9a:367/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:4839004 errors:0 dropped:0 overruns:0 frame:0 TX packets:5852922 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:670518236 (639.4 MiB) TX bytes:1589348208 (1.4 GiB)wlan1 Link encap:Ethernet HWaddr 04:A1:51:9A:03:69 inet6 addr: fe80::6a1:51ff:fe9a:369/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:5443036 errors:0 dropped:0 overruns:0 frame:0 TX packets:9474688 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1115674576 (1.0 GiB) TX bytes:1268032438 (1.1 GiB)
Here, br-lan, eth0, eth0.1... What does it mean?
After reading this information, you can see that the system file (network, wireless) has been configured for wired and wireless.
root@OpenWrt:/etc/config# cat network config interface 'loopback' option ifname 'lo' option proto 'static' option ipaddr '127.0.0.1' option netmask '255.0.0.0'config globals 'globals' option ula_prefix 'fdbb:e076:9029::/48'config interface 'lan' option ifname 'eth0.1' option force_link '1' option type 'bridge' option proto 'static' option netmask '255.255.255.0' option ip6assign '60' option macaddr '04:a1:51:9a:03:67' option ipaddr '198.100.100.1'config interface 'wan' option ifname 'eth0.2' option proto 'dhcp' option macaddr '04:a1:51:9a:03:68'config interface 'wan6' option ifname 'eth0.2' option proto 'dhcpv6'config switch option name 'switch0' option reset '1' option enable_vlan '1'config switch_vlan option device 'switch0' option vlan '1' option ports '0t 1 2 3 4'config switch_vlan option device 'switch0' option vlan '2' option ports '0t 5'root@OpenWrt:/etc/config# cat wireless config wifi-device 'radio0' option type 'mac80211' option hwmode '11g' option path 'platform/ar934x_wmac' option htmode 'HT20' option txpower '22' option country 'US' option channel '6'config wifi-device 'radio1' option type 'mac80211' option channel '36' option hwmode '11a' option path 'pci0000:00/0000:00:00.0' option htmode 'HT20' option txpower '14' option country 'US'config wifi-iface option device 'radio1' option network 'lan' option mode 'ap' option ssid 'jthlw-cj5G' option encryption 'psk-mixed' option key '11223344'config wifi-iface option device 'radio0' option mode 'ap' option network 'lan' option ssid 'jthlw-cj' option encryption 'psk-mixed' option key 'cjcjcj12345'
First paste a pirated openwrt architecture:
The two NICs of the Gateway: eth0 and eht2 are both wired and wireless NICs. These two NICs have their corresponding mac addresses.
Configure
config interface 'lan' option ifname 'eth0.1' option force_link '1' option type 'bridge' option proto 'static' option netmask '255.255.255.0' option ip6assign '60' option macaddr '04:a1:51:9a:03:67' option ipaddr '198.100.100.1' config interface 'wan' option ifname 'eth0.2' option proto 'dhcp' option macaddr '04:a1:51:9a:03:68'
It can be seen that eth0 is a wired network card, and eth0.1 and eth0.2 are virtualized from the above through the switch. eth0.1 corresponds to the LAN port, eth0.2 corresponds to the WAN port, and its address can be modified manually.
Radio0 and radio1 correspond to wireless NICs (2.4G, 5G)
The br-lan is virtualized for unified management of the LAN
root@OpenWrt:/etc/config# brctl showbridge name bridge id STP enabled interfacesbr-lan 7fff.04a1519a0367 no eth0.1 wlan1 wlan0
Therefore, we can see that eth0.2 is used for the WAN port. The IP address at the upper level is 193.168.1.125. eth0.1 is used for managing the LAN port. The IP addresses of the sub-LAN ports are allocated by 198.100.100.1.
(The above is just a little bit of my understanding of the gateway. For more information, refer to the blogs referenced below, and refer to firewall settings:, etc/config )))