Ubuntu – configuring vlan on Ubuntu

Ubuntuvlan

I have bridged eth0 and wlan0, and have given a static ip for the br0 interface. I wanted to have a vlan interface. I did modprobe 8021q and I did the following:

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

Then I tried to ping from br0.5 to my router that has 192.168.1.1 ip, which can be accessed via br0.

ping -I br0.5 192.168.1.1

The replay I get is Destination Host Unreachable.

Here is the output of 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:

But the vlan interface can be pinged from other hosts. I pinged the ip of br0.5 (192.168.1.100) form a host on the network and it responded to the pings. So why can't I use br0.5 to reach for other hosts on the network?

EDIT 1:

Output of 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 

Best Answer

I did the following: ifconfig br0.5 192.168.1.100 netmask 255.255.255.0... Then I tried to ping from br0.5 to my router that has192.168.1.1 ip...

You need to use a separate subnet for the two networks. So VLAN 1 is currently 192.168.1.0/24, you might want to use 192.168.5.0/24 for your VLAN 5.