zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    【转】JS模块化工具requirejs教程(二):基本知识
    【转】JS模块化工具requirejs教程(一):初识requirejs
    【转】批处理命令 For循环命令详解!
    【转】NodeJS教程--基于ExpressJS框架的文件上传
    【转】WebSocket 是什么原理?为什么可以实现持久连接?
    网页工具地址
    【转】DataURL在Web浏览器中的兼容性总结
    侯捷STL学习(一)--顺序容器测试
    strstr-strcat实现
    算法设计与分析
  • 原文地址:https://www.cnblogs.com/abacuspix/p/2707137.html
Copyright © 2011-2022 走看看