Ubuntu14.04 builds gateway server and DHCP server

Gateway server construction
1. The gateway server needs at least two network cards, taking eth0 and eth1 as an example
eth0:188.66.5.6/24 external network address
eth1:192.168.1.1/24 Intranet address

2. In ubutu, open /etc/network/interfaces and add at the end of the file:
auto eth0
iface eth0 inet static
address 188.66.5.6
netmask 255.255.255.0
gateway 188.66.5.1
auto eth1
iface eth1 inet static
address 192.168.1.1
netmask 255.255.255.0



After the configuration is complete, restart the server. The machine now has access to both networks.
3. Configure the DHCP server on the gateway server
Install dhcp server
sudo sudo apt-get install dhcp3-server

Modify the file /etc/default/isc-dhcp-server
to INTERFACES="eht1"
backup DHCP main configuration file /etc/dhcp/dhcpd.conf
sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp3/dhcpd.conf.backup

Modify the DHCP main configuration file /etc/dhcp/dhcpd.conf
to block duplicate scripts:
#option domain-name "example.org";
#option domain-name-servers ns1.example.org, ns2.example.org;
#default-lease-time 600;
#max-lease-time 7200;

Modify the script as follows:
# A slightly different configuration for an internal subnet.
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.250; #dynamic address pool range
option domain-name-servers 202.66.66.6; #DNS address
option routers 192.168.1.1; #Gateway address
option broadcast-address 192.168.1.255; #Broadcast address
default-lease-time 86400; #Default lease for 24 hours
max-lease-time 90000;
}

Restart DHCP server
sudo /etc/init.d/isc-dhcp-server restart

Test DHCP server function
Test DHCP is very simple, directly change the IPv4 configuration of the host system to DHCP automatic acquisition, and successfully use ipconfig to view the allocated parameters.

At this point, the server is set up.

For the firewall function of the gateway server, use iptables for configuration, which is not described here.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326644173&siteId=291194637