标签:cal nta install ubunt main ras 禁用 wlan wifi
ubuntu-mate 搭建无线路由器**auto eth0
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet static
address 172.168.1.1
netmask 255.255.255.0
broadcast 172.168.1.255
network 172.168.1.0
4.执行以下脚本禁用NetworkManager后重新启动,
#!/bin/bash
systemctl stop NetworkManager.service
systemctl disable NetworkManager.service
reboot
5.Install hostapd
5.1.sudo apt isntall hostapd
5.2. sudo service hostapd stop
5.3 sudo vi /etc/hostapd/hostapd.conf
interface=wlan0
driver=nl80211
ssid=your_wifi_name
hw_mode=g
channel=3
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=your_wifi_password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
Save.
5.4 sudo cat >/etc/default/hostapd
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Ctrl +D Save.
5.5 sudo service hostapd restart
6.Install dhcp ,sudo apt install isc-dhcp-server
6.1 stop dhcp server
sudo service isc-dhcp-server stop
6.2 mv /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.origin.bak
vi /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 172.168.1.255;
option routers 172.168.1.1;
option domain-name-servers 202.96.128.86,8.8.8.8;
#option domain-name "example.com";
subnet 172.168.1.0 netmask 255.255.255.0 {
range 172.168.1.100 172.168.1.150;
}
null
6.3 vi /etc/default/isc-dhcp-serverINTERFACES="wlan0"
6.4 restart DHCP service.
sudo service isc-dhcp-server start
7.Activationg the IPV4 forward ,change the following line in sysctl.conf
7.1 sudo vi /etc/systcl.confnet.ipv4.ip_forward=1
7.2 sysctl -p
8.Changing the Firewall
*sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
8.1 Check the iptabls
sudo iptables -L -n -v
8.2 Save the rules
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
sudo vi /etc/rc.local
#add the follow line before "exit 0"
`iptables-restore < /etc/iptables.ipv4.nat*`
Done.
.
标签:cal nta install ubunt main ras 禁用 wlan wifi
原文地址:http://blog.51cto.com/10108149/2137038