Ubuntu-mate Building a wireless router

Source: Internet
Author: User
Tags iptables

Ubuntu-mate Building a wireless router * *
1. sudo apt update
2.ip Addr View network information (wired network card is eth0, wireless card is wlan0)
3. sudo vi/etc/network/interfaces, and then save after entering the following content.

auto eth0iface eth0 inet dhcpallow-hotplug wlan0iface wlan0 inet staticaddress 172.168.1.1netmask 255.255.255.0broadcast 172.168.1.255network 172.168.1.0

4. Execute the following script to disable NetworkManager after reboot,
#!/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=wlan0driver=nl80211ssid=your_wifi_namehw_mode=gchannel=3wmm_enabled=0macaddr_acl=0auth_algs=1ignore_broadcast_ssid=0wpa=2wpa_passphrase=your_wifi_passwordwpa_key_mgmt=WPA-PSKwpa_pairwise=TKIPrsn_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-server
INTERFACES="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.conf
net.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.

.

Ubuntu-mate Building a wireless router

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.