你的位置:首页 > 操作系统

[操作系统]Ubuntu无线转有线教程


本来想测试一下有线转无线的,奈何网卡不支持,所以就测试了一回无线转有线的测试!(真无聊,不过也算学习一下linux网桥的知识)

 

ca0gu0@ub:~$ sudo brctl addbr br0 #添加网桥ca0gu0@ub:~$ brctl show #查看网桥bridge name  bridge id  STP enabled  interfacesbr0  8000.000000000000  no

 

ca0gu0@ub:~$ sudo brctl addif br0 eth0 #将物理网卡做为虚拟网桥的端口ca0gu0@ub:~$ sudo brctl delif br0 eth0 #删除网桥接中的物理网卡ca0gu0@ub:~$ brctl show #查看bridge name  bridge id  STP enabled  interfacesbr0  8000.00e04c0e681a  no  eth0

 

ca0gu0@ub:~$ sudo ifconfig br0 192.168.20.2 up #开启虚拟接口ca0gu0@ub:~$ ip addr1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft foreverinet6 ::1/128 scope host valid_lft forever preferred_lft forever2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast master br0 state DOWN group default qlen 1000link/ether 00:e0:4c:0e:68:1a brd ff:ff:ff:ff:ff:ff3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000link/ether c8:e7:d8:fd:9c:78 brd ff:ff:ff:ff:ff:ffinet 192.168.90.102/24 brd 192.168.90.255 scope global wlan0valid_lft forever preferred_lft foreverinet6 fe80::cae7:d8ff:fefd:9c78/64 scope link valid_lft forever preferred_lft forever4: br0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default link/ether 00:e0:4c:0e:68:1a brd ff:ff:ff:ff:ff:ffinet 192.168.20.2/24 brd 192.168.20.255 scope global br0valid_lft forever preferred_lft fore

  

ca0gu0@ub:~$ sudo apt-get install isc-dhcp-server  # 安装dhcp服务ca0gu0@ub:~$ sudo vi /etc/default/isc-dhcp-serverINTERFACES="br0"ca0gu0@ub:~$ sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf_bkca0gu0@ub:~$ sudo vi /etc/dhcp/dhcpd.confsubnet 192.168.20.0 netmask 255.255.255.0 {range 192.168.20.100 192.168.20.200;option broadcast-address 192.168.2.255;default-lease-time 600;max-lease-time 7200;}ca0gu0@ub:~$ sudo /etc/init.d/isc-dhcp-server start* Starting ISC DHCP server dhcpd [ OK ]

 

ca0gu0@ub:~$ ifconfig br0 down #停止虚拟接口ca0gu0@ub:~$ sudo brctl delbr br0  #删除虚拟接口

 

ca0gu0@ub:~$ ifconfig br0 down #停止虚拟接口ca0gu0@ub:~$ sudo brctl delbr br0  #删除虚拟接口