![当使用两个 VLAN 配置 Linux 时无法 ping 通 GW?](https://linux22.com/image/641850/%E5%BD%93%E4%BD%BF%E7%94%A8%E4%B8%A4%E4%B8%AA%20VLAN%20%E9%85%8D%E7%BD%AE%20Linux%20%E6%97%B6%E6%97%A0%E6%B3%95%20ping%20%E9%80%9A%20GW%EF%BC%9F.png)
我的情况:
vlan1 <--------> [interface0/1] L3 Switch [interface0/2]<-----------> vlan2
通过关注教程:
vlan1 有一台 linux 机器:
我配置Linux有2个虚拟局域网eth0.1
:eth0.2
[root@dd ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:48:23:C0
inet6 addr: fe80::20c:29ff:fe48:23c0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3285 errors:0 dropped:0 overruns:0 frame:0
TX packets:717 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:267464 (261.1 KiB) TX bytes:41002 (40.0 KiB)
Interrupt:19 Base address:0x2000
eth0.2 Link encap:Ethernet HWaddr 00:0C:29:48:23:C0
inet addr:192.168.2.3 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe48:23c0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:126 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:6228 (6.0 KiB)
eth0.1 Link encap:Ethernet HWaddr 00:0C:29:48:23:C0
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe48:23c0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:126 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:6228 (6.0 KiB)
我将 L3 交换机接口 0/1 配置为 vlan1 的一部分,并将 vlan1 接口配置为具有以下地址:
ip address 192.168.1.1
问题是我无法192.168.1.1
从 Linux 机器 ping 通接口。
192.168.1.1
注意:当我在 Linux 机器上有一张网卡时,我可以 ping 通接口:
[root@dd ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:48:23:C0
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe48:23c0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3285 errors:0 dropped:0 overruns:0 frame:0
TX packets:717 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:267464 (261.1 KiB) TX bytes:41002 (40.0 KiB)
Interrupt:19 Base address:0x2000
那么我应该怎么做才能让 eth0.1 ping 接口,我遗漏了什么?
答案1
请勿使用 vlan #1,它在我用过的大多数设备中都是保留的,如果您使用 vlan 标记,它将无法正常工作。
重新配置所有交换机和服务器以使用其他东西(即:vlan 3),这样就可以开始工作了。