Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the reason for the failure of Linux bridge ping virtual network card?

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article shows you what is the reason for the failure of the Linux bridge ping virtual network card, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Explain why Linux veth0/1 + bridge ping doesn't work.

The reason is all in the ip route show table local output. Go straight to the previous step:

[dahui@192] $route-v

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

Default 192.168.1.1 0.0.0.0 UG 100 00 em1

192.168.1.0 0.0.0.0 255.255.255.0 U 100 00 em1

[dahui@192 ~] $

# create a veth pair.

Sudo ip link add veth0 type veth peer name veth2

# set the IP address to veth

Sudo ip addr add 192.168.2.10/24 dev veth0

Sudo ip addr add 192.168.2.20/24 dev veth2

# activate the API

Sudo ip link set veth0 up

Sudo ip link set veth2 up

# directly connected routes are automatically added to the routing table

[dahui@192] $route-v

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

Default 192.168.1.1 0.0.0.0 UG 100 00 em1

192.168.1.0 0.0.0.0 255.255.255.0 U 100 00 em1

192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 veth0

192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 veth2

[dahui@192 ~] $

# create a linux bridge br0

Sudo ip link add name br0 type bridge

Sudo ip link set br0 up

# connecting veth0 to br0,veth0 with ip can receive data from the protocol stack, but reponse can only go br0.

Sudo ip link set dev veth0 master br0

# it doesn't make sense for veth0 to have IP. Give this IP to br0

Sudo ip addr del 192.168.2.10/24 dev veth0

Sudo ip addr add 192.168.2.10/24 dev br0

# look forward to the success of ping veth3 through the br0 interface. But failed.

[dahui@192] $ping-c 1-I br0 192.168.2.20

PING 192.168.2.20 (192.168.2.20) from 192.168.2.10 br0: 56 (84) bytes of data.

-192.168.2.20 ping statistics-

1 packets transmitted, 0 received, 100% packet loss, time 0ms

[dahui@192 ~] $

The following is the local routing table maintained by the system:

[dahui@192 ~] $ip route show table local

Broadcast 127.0.0.0 dev lo proto kernel scope link src 127.0.0.1

Local 127.0.0.0/8 dev lo proto kernel scope host src 127.0.0.1

Local 127.0.0.1 dev lo proto kernel scope host src 127.0.0.1

Broadcast 127.255.255.255 dev lo proto kernel scope link src 127.0.0.1

Broadcast 192.168.1.0 dev em1 proto kernel scope link src 192.168.1.10

Local 192.168.1.10 dev em1 proto kernel scope host src 192.168.1.10

Broadcast 192.168.1.255 dev em1 proto kernel scope link src 192.168.1.10

Broadcast 192.168.2.0 dev veth2 proto kernel scope link src 192.168.2.20

Broadcast 192.168.2.0 dev br0 proto kernel scope link src 192.168.2.10

Local 192.168.2.10 dev br0 proto kernel scope host src 192.168.2.10

Local 192.168.2.20 dev veth2 proto kernel scope host src 192.168.2.20

Broadcast 192.168.2.255 dev veth2 proto kernel scope link src 192.168.2.20

Broadcast 192.168.2.255 dev br0 proto kernel scope link src 192.168.2.10

[dahui@192 ~] $

Reference:

Https://unix.stackexchange.com/questions/205708/linux-does-not-reply-to-arp-request-messages-if-requested-ip-address-is-associat

What is the reason for the failure of the Linux bridge ping virtual network card? have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report