zoukankan      html  css  js  c++  java
  • Linux bridge

    CentOS bridge 配置:

    1、创建br0配置文件
      touch /etc/sysconfig/network-scripts/ifcfg-br0

    2、修改bro配置文件

    vi /etc/sysconfig/network-scripts/ifcfg-br0

    DEVICE=br0
    TYPE=Bridge
    BOOTPROTO=static
    IPADDR=0.0.0.0
    ONBOOT=yes
    

    3、添加网卡到网桥

    vi /etc/sysconfig/network-scripts/ifcfg-eth0

    DEVICE=eth0   # 把eth0添加到网桥中
    TYPE=Ethernet
    BOOTPROTO=static
    IPADDR=0.0.0.0
    ONBOOT=yes
    BRIDGE=br0
    

     

    Ubuntu bridge配置

    root@ubuntu~#vim /etc/network/interfaces
    
    auto lo eth0 eth1 br0
    
    iface lo inet loopback
    
    iface br0 inet static
    
        address 10.10.10.1
    
        netmask 255.255.0.0
    
        gateway 10.10.10.254
    
        pre-up ip link set eth0 promisc on  #设置混杂模式
    
        pre-up ip link set eth1 promisc on  
    
        pre-up echo "1">/proc/sys/net/ipv4/ip_forward  #启用路由转发
    
        bridge_stp off  #关闭生成树
    
        bridge_ports eth0 eth1
    

     

    brctl 命令集

    root@Openstack001:~# brctl
    Usage: brctl [commands]
    commands:
    	addbr     	<bridge>		add bridge
    	delbr     	<bridge>		delete bridge
    	addif     	<bridge> <device>	add interface to bridge
    	delif     	<bridge> <device>	delete interface from bridge
    	hairpin   	<bridge> <port> {on|off}	turn hairpin on/off
    	setageing 	<bridge> <time>		set ageing time
    	setbridgeprio	<bridge> <prio>		set bridge priority
    	setfd     	<bridge> <time>		set bridge forward delay
    	sethello  	<bridge> <time>		set hello time
    	setmaxage 	<bridge> <time>		set max message age
    	setpathcost	<bridge> <port> <cost>	set path cost
    	setportprio	<bridge> <port> <prio>	set port priority
    	show      	[ <bridge> ]		show a list of bridges
    	showmacs  	<bridge>		show a list of mac addrs
    	showstp   	<bridge>		show bridge stp info
    	stp       	<bridge> {on|off}	turn stp on/off
    
  • 相关阅读:
    1061. 判断题(15)
    1070. 结绳(25)
    1069. 微博转发抽奖(20)
    1068. 万绿丛中一点红(20)
    1067. 试密码(20)
    DB2sql关键字——ALTER TABLE ....ACTIVATE NOT LOGGED INITIALLY WITH EMPTY TABLE
    DB2系统内置——SYSCAT.TABLES 所有的字段说明
    DB2系统内置——db2日期和时间常用汇总
    Linux——下查找某个文件位置的方法
    Linux下清除tomcat缓存
  • 原文地址:https://www.cnblogs.com/vincenshen/p/6295711.html
Copyright © 2011-2022 走看看