在Ubuntu上configurationvlan

我桥接了eth0wlan0 ,并给了br0接口一个静态ip。 我想有一个vlan接口。 我做了modprobe 8021q ,我做了以下几点:

 vconfig add br0 5 ifconfig br0.5 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 up 

然后我试图从br0.5 ping到我的路由器,它有192.168.1.1 ip,可以通过br0访问。

 ping -I br0.5 192.168.1.1 

我得到的重播是Destination Host Unreachable

这里是cat /proc/net/vlan/br0.5的输出:

 br0.5 VID: 5 REORDER_HDR: 1 dev->priv_flags: 1 total frames received 0 total bytes received 0 Broadcast/Multicast Rcvd 0 total frames transmitted 329 total bytes transmitted 20447 total headroom inc 0 total encap on xmit 329 Device: br0 INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 EGRESS priority mappings: 

但是vlan接口可以从其他主机ping通。 我ping的br0.5(192.168.1.100)的IP在networking上形成一个主机,它回应ping。 那么为什么我不能使用br0.5来连接networking上的其他主机呢?

编辑1:

iptables -vL输出:

 Chain INPUT (policy ACCEPT 823 packets, 215K bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 5 packets, 671 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 705 packets, 220K bytes) pkts bytes target prot opt in out source destination 

我做了以下: ifconfig br0.5 192.168.1.100 netmask 255.255.255.0...然后,我试图从br0.5 ping我的路由器有192.168.1.1 ip …

您需要为两个networking使用单独的子网。 因此,VLAN 1当前为192.168.1.0/24,您可能希望使用192.168.5.0/24作为您的VLAN 5。