首页 > 代码库 > Redhat(CentOS、Fedora)下的桥接步骤

Redhat(CentOS、Fedora)下的桥接步骤

1,安装桥接软件包

yum install bridge-utils

2,修改文件/etc/sysconfig/network-scropts/ifcfg-eth0;
BRIDGE=br0

删除下面

ONBOOT=yes
IPADDR=10.0.0.23
NETMASK=255.255.255.0
GATEWAY=10.0.0.1
DNS1=61.134.1.4

3,建立文件/etc/sysconfig/network-scripts/ifcfg-br0;

BEVICE=br0
BOOTPROTO=none
TYPE=Bridge
ONBOOT=yes
DELAY=0
IPADDR=10.0.0.23
NETMASK=255.255.255.0
GATEWAY=10.0.0.1
DNS1=61.134.1.4
(注意DNS只有一个也要写DNS1,不能直接写DNS)

4,重启;
5,确认网桥是否存在;
/usr/sbin/brct1 show

若成功则显示

[root@server17 ~]# brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.000c297c68aa       no              eth0

[root@server17 ~]# ifconfig br0
br0       Link encap:Ethernet  HWaddr 00:0C:29:7C:68:AA  
          inet addr:10.0.0.22  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe7c:68aa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2268 errors:0 dropped:0 overruns:0 frame:0
          TX packets:558 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:134076 (130.9 KiB)  TX bytes:76172 (74.3 KiB)

w查看当前用户

ip addr show eth0
ip -s link show eth0
ip route/traceroute/dig