Creating a Similar Network: Internet Sharing with BootP DHCP Disabled
Internet Sharing is a method that allows multiple computers to share a single internet connection. In this guide, we will discuss how to create a similar network with BootP DHCP disabled.
Prerequisites
- A system acting as a gateway (router) with two network interfaces: one connected to the internet (eth0) and the other connected to the local network (eth1).
- A Linux distribution (e.g., Ubuntu, CentOS, etc.) installed on the gateway.
Step 1: Disable BootP DHCP
By default, Ubuntu and CentOS use ISC DHCP server, which includes both BootP and DHCP. To disable BootP DHCP, follow these steps:
Ubuntu
- Open the DHCP configuration file:
sudo nano /etc/dhcp/dhcpd.conf
- Find the line starting with
subnetand addno-bootstrapat the end:
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200;
option routers 192.168.1.1;
option domain-name-servers 8.8.8.8, 8.8.4.4;
no-bootstrap;
}
-
Save and close the file.
-
Restart the DHCP service:
sudo systemctl restart isc-dhcp-server
CentOS
- Open the DHCP configuration file:
sudo vi /etc/dhcp/dhcpd.conf
- Find the line starting with
subnetand addno-bootstrapat the end:
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200;
option routers 192.168.1.1;
option domain-name-servers 8.8.8.8, 8.8.4.4;
no-bootstrap;
}
-
Save and close the file.
-
Restart the DHCP service:
sudo systemctl restart dhcpd
Step 2: Configure Internet Sharing
- Open the network interface configuration file for eth0:
sudo nano /etc/network/interfaces
- Add the following lines to the file:
auto eth0
iface eth0 inet dhcp
up iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
- Open the network interface configuration file for eth1:
sudo nano /etc/network/interfaces
- Add the following lines to the file:
auto eth1
iface eth1 inet static
address 192.168.1.1
netmask 255.255.255.0
broadcast 192.168.1.255
up iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
up iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
-
Save and close the files.
-
Apply the network interface changes:
sudo ifdown eth0 && sudo ifup eth0
sudo ifdown eth1 && sudo ifup eth1
Step 3: Run the Script Adapter (bridge100)
The script adapter (bridge100) is not needed in this setup as we have configured the forwarding rules in the iptables.
Problem with Getting IP
If the client computers are not getting an IP address, ensure that DHCP is disabled on them, and they are set to obtain an IP address automatically. If they are still not getting an IP address, try setting a static IP address on the client computers within the same subnet as the gateway (e.g., 192.168.1.x).
References