• Ubuntu – vlan & bridge configuration


    1. Install VLAN package on your computer:

    sudo apt-get install vlan

    2. Edit your /etc/network/interfaces file so it would contain the following:

    # The loopback network interface
    auto lo
    iface lo inet loopback

    # This is a list of hotpluggable network interfaces.
    # They will be activated automatically by the hotplug subsystem.
    auto vlan4
    auto vlan5

    VLAN 4
    iface vlan4 inet static
    address 192.168.0.8
    netmask 255.255.255.192
    network 192.168.0.0
    broadcast 192.168.0.63
    mtu 1500
    vlan_raw_device eth0

    VLAN 5
    iface vlan5 inet manual
    up ifconfig $IFACE 0.0.0.0 up
    mtu 1500
    vlan_raw_device eth0

    Note: You have to replace my IP addresses, network masks and gateway IP address with your own.

    3. Make sure that switch interface you are connected to configured with respective VLANs.

    4. Restart your network interface:
    sudo /etc/init.d/networking restart

    You should see something like:
    Set name-type for VLAN subsystem. Should be visible in /proc/net/vlan/config
    Added VLAN with VID == 4 to IF -:eth0:-
    Set name-type for VLAN subsystem. Should be visible in /proc/net/vlan/config
    Added VLAN with VID == 5 to IF -:eth0:-

    See more examples in /usr/share/doc/ifupdown/examples/network-interfaces.gz

    Bridge setup :
    1. apt-get install bridge-utils
    2. Edit your /etc/network/interfaces file so it would contain the following:

    [ a bridge with an associated IP address ]
    iface br0 inet static
    bridge-ports eth0 eth1
    address 192.168.1.1
    netmask 255.255.255.0
    [ a bridge which acts as an anonymous bridge ]
    iface br0 inet manual
    bridge-ports eth0 eth1
    up ifconfig $IFACE up

    My Sample configuration for Ubuntu KVM networking config, the host vlan is vlan3, the vm guest vlan is vlan5

    auto lo
    iface lo inet loopback
    auto vlan3
    auto vlan4
    auto br0

    #vlan3
    iface vlan3 inet static
    address 137.189.xx.xx
    netmask 255.255.255.0
    gateway 137.189.xx.254
    mtu 1500
    vlan_raw_device eth0

    #vlan4
    iface vlan4 inet manual
    up ifconfig $IFACE 0.0.0.0 up
    vlan_raw_device eth0

    #br0
    iface br0 inet manual
    bridge-ports vlan4
    bridge_stp off
    bridge_fd 0
    bridge_macwait 0
    up ifconfig $IFACE up

  • 相关阅读:
    面试题收集——Java基础部分(一)
    Eclipse在线安装SVN
    一、 Log4E插件下载
    MyEclipse使用总结——MyEclipse中配置WebLogic12c服务器
    MyEclipse使用总结——使用MyEclipse打包带源码的jar包
    MyEclipse使用总结——设置MyEclipse使用的Tomcat服务器
    MyEclipse使用总结——设置MyEclipse开发项目时使用的JDK
    MyEclipse使用总结——修改MyEclipse默认的Servlet和jsp代码模板
    MyEclipse使用总结——MyEclipse文件查找技巧
    CMSIS Example
  • 原文地址:https://www.cnblogs.com/abacuspix/p/2707137.html
Copyright © 2020-2023  润新知