Forward Internet In Lunux or NAT

  1. sudo ifconfig eth0 address 10.42.0.1
  2. echo 1 > /proc/sys/ipv4/ipforward
  3. sudo iptables -t nat -A POSTROUTING -s 10.42.0.0/24 ! -d 10.42.0.0/24 -j MASQUERADE
  4. Install dnsmasq -> sudo apt-get install dnsmasq
  5. configure dnsmasq.config as
    • sudo nano /etc/dnsmasq.conf
      • interface=eth0
      • dhcp-range=10.42.0.100,10.42.0.200
Advertisements