* ------- ------- use routers to build ATC ------- * -------
First, install Ubuntu
https://www.ubuntu.com/download/desktop
Second, the router settings
1. Turn off the router DHCP function
2. Change the router lan port ip (so it is not a gateway address): 192.168.1.11, change it to manual
3. usb port connecting the router to the computer network, router network cable lan port (port must lan)
4. Set usb NIC IP gateway address: 192.168.1.1, permanent set
Third, install dhcp
1.apt-get install isc-dhcp-server
2. Perform dhcpd, dhcp check whether the normal start, if an error
1) execute ls -l /var/lib/dhcp/dhcpd.leases, if not the file, execute touch /var/lib/dhcp/dhcpd.leases
2) execute chmod 777 /var/lib/dhcp/dhcpd.leases
Fourth, the dhcp
1. vim /etc/dhcp/dhcpd.conf
Finally, add the file:
192.168.1.0 Netmask 255.255.255.0 subnet
{
Range 192.168.1.2 192.168.1.10;
Option Routers 192.168.1.1;
Option-name-Domain Servers 192.168.20.178,192.168.20.185; # First, the DNS alternatively
}
Note: in the subnet is defined in the the segment to be consistent with the usb card IP network segment in which
2. vim /etc/default/isc-dhcp-server
The file INTERFACES = "" line instead INTERFACES = "enx00e04c361ab7"
enx00e04c361ab7 as usb card name to see with ifconfig
3. Start dhcp-server (before executing the following command to confirm usb card IP is set became 192.168.1.11)
mkdir /var/run/dhcp-server
touch /var/run/dhcp-server/dhcpd.pid
chmod 777 /var/run/dhcp-server/dhcpd.pid
chmod 777 /var/lib/dhcp/dhcpd.leases
dhcpd enx00e04c361ab7 -pf /var/run/dhcp-server/dhcpd.pid
Execute netstat -uap
If the installation configuration represents a dhcp service started successfully when the display dhcp program name column
Five, IP forwarding
There are two ways online
1)执行sudo bash -c "echo 1 >/proc/sys/net/ipv4/ip_forward"
2) In the /etc/sysctl.conf file, uncomment this line:
net.ipv4.ip_forward = 1
then execute them to take effect immediately
sudo sysctl -p
safe, have implemented
iptables -F
iptables -X
iptables -t nat -A POSTROUTING -o ens33 -j MASQUERADE
iptables -A FORWARD -i ens33 -o enx00e04c361ab7 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i enx00e04c361ab7 -o ens33 -j ACCEPT
Save the above configuration iptables down, execution bash -c "iptables-save> /etc/iptables.ipv4.nat"
Edit
/ etc / network / interfaces
and add the following line at the end so that load automatically each time you start iptables configuration:
up iptables-Restore </etc/iptables.ipv4.nat
Seven, installation atc
Please refer to https://www.jianshu.com/p/05c82f273c0c
Environment to build links:
https://www.jianshu.com/p/05c82f273c0c
Allowed to solve the bandwidth links:
https://www.cnblogs.com/crazymanpj/p/9563365.html