Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am playing with Vlan configuration on CentOS 6.4

I have 2 interfaces, eth0 and eth1.

I have configured 2 VLAN interfaces eth0.20 and eth0.30 as

     #file: ifcfg-eth0.20
     #-------------

    VLAN=yes
    DEVICE=eth0.20
    TYPE=Ethernet
    ONBOOT=yes
    NM_CONTROLLED=no
    BOOTPROTO=static
    IPADDR=192.168.20.1
    GATEWAY=192.168.20.1
    NETMASK=255.255.255.0
    USERCTL=no


    #file: ifcfg-eth0.30
    #-------------
    VLAN=yes
    DEVICE=eth0.30
    TYPE=Ethernet
    ONBOOT=yes
    NM_CONTROLLED=no
    BOOTPROTO=static
    IPADDR=192.168.30.1
    GATEWAY=192.168.30.1
    NETMASK=255.255.255.0
    USERCTL=no

Then connected a desktop to interface eth0 port using LAN cable and assigned 192.168.30.2/24 IP.

When I try to ping 192.168.30.1 from 192.168.30.2 machine, It shows destination host unreachable. I am also not able to ping 192.168.130.2 from 192.168.30.1.

However ping -I eth0 192.168.30.2 works fine.

Please let me know any pointers in this regard.

share|improve this question
1  
Hi Amrit! Did you notice that you've tagged both interfaces with VLAN20??? DEVICE=eth0.20 in your ifcfg-eth0.30 file –  Petter H Aug 21 '13 at 5:41
    
is the .2 interface 'tagged'? I think it's a tag problem ( .1 tagged vs .2 untagged ) but i've no time to expand the answer atm. No ideas about why " -l " is working. –  user1293137 Aug 21 '13 at 15:48
add comment

1 Answer

It seems like you have wrong design.

In VLANs you basically have two tipes of ports: TRUNK PORTS (or tagged ports) and ACCESS PORTS (or untagged ports). TRUNK PORTS should be connected to TRUNK PORTS and ACCESS PORTS to ACCESS PORTS.

Now in your configuration you have a TRUNK port eth0 with two TAGGED VLANS in there - eth0.20 and eth0.30 and ACCESS port on the desktop side (default). You need the same configuration on the other side of the cable (desktop) to have connectivity. On a desktop configure a TRUNK port with two TAGGED VLANS with subinterfaces for vlan20 (eth0.20 in linux) and vlan30 (eth0.30). Then configure the 192.168.30.2/24 IP on a vlan30 sub interface. Now you will be able to ping 192.168.30.1.

Another option is to use a hardware SWITCH that supports VLANs. Then on a swith you can configure a TRUNK port with two TAGGED VLANS and connect it to Centos side. Again on a switch configure ACCESS port to be in vlan30 and connect it to a desktop. Leave the current configuration on a desktop - 192.168.30.2/24 IP directly on the interface. You will have connectivity.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.