Setting up ICS is pretty simple...
Basically you need to enter two commands into the console:
1. sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
- this command will share the connection from eth0 device to all other devices on your PC (wlan0, eth1, etc.)
In case you have IPTABLES, this command must not work, until you clear all necessary rules.
Don't forget to set FORWARD chain in iptables to accept (or add your own custom rule):
iptables -P FORWARD ACCEPT
2. echo 1 > /proc/sys/net/ipv4/ip_forward
- this command need to be executed as root. It'll allow IP forwarding.
That's all, now you can connect other devices and access the internet, of course you need to set DNS, default GW and IP address.
In case you are using DHCP Server, you can send necessary information automatically:
Open the dhcp configuration file ( usually /etc/dhcpd.conf) and add a host:
host Lenovo {This will add section Lenovo host. When the device with the defined MAC address is connected, it gets the specified IP address (fixed-address) and the DNS (domain-name-servers), broadcast and default GW (routers) addresses. (The default GW is the IP address of the computer sharing connection.)
hardware ethernet FF:FF:FF:FF:FF:FF;
fixed-address 192.168.1.100;
option domain-name-servers 160.210.100.200,160.210.1.20;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.10;
}
No comments:
Post a Comment