树莓派两个无线网卡搭建wifi

参考:

http://blog.csdn.net/btyh17mxy/article/details/17281781
http://blog.csdn.net/xukai871105/article/details/42497097/

我的两个网卡分别为 wlan0 作为内部局域网AP,wlan1链接外网

一、配置DHCP服务器


1、固定内部网卡IP地址

sudo gedit /etc/network/interfaces

注释掉原有内容,插入以下内容:
#allow-hotplug wlan0
#iface wlan0 inet manual
#    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan0
iface wlan0 inet static
  address 172.16.0.1
  netmask 255.255.255.0

这里应注意我的有线端口叫“wlan0”,各位应根据自己情况自行修改

 2、配置DHCP服务

编辑isc-dhcp-server

sudo vi /etc/default/isc-dhcp-server

增加如下内容
INTERFACES="wlan0"
编辑dhcpd.conf
sudo vi /etc/dhcp/dhcpd.conf
增加如下内容
ddns-update-style interim;  
ignore client-updates;  
allow bootp;  
allow booting;  
  
subnet 172.16.0.0 netmask 255.255.255.0 {  
  
    option routers 172.16.0.1;  
    option subnet-mask 255.255.255.0;  
    next-server 172.16.0.1;  
    filename="pxelinux.0";  
    option time-offset -18000; #Eastern Standard Time  
  
    range 172.16.0.2 172.16.0.10; #子网ip从172.16.0.2到192.168.0.10  
    default-lease-time 21600;  
    max-lease-time 43200;  
}

启动DHCP服务,运行:
sudo service isc-dhcp-server start

如果启动失败,可以运行以下命令察看Log分析原因
sudo tail -f /var/log/syslog | grep dhcpd

你可能感兴趣的:(Linux,Tcp/Ip,攻防/运维)