User Tools

Site Tools


ubuntu:gateway

Quick Links

Setup Gateway

  • Edit /etc/network/interfaces
 This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

# The secondary network interface
iface eth1 inet static
address 192.168.0.1
netmask 255.255.255.0
  • Restart networking
# This does not work: /etc/init.d/networking restart
sudo ifdown eth1 && sudo ifup eth1
  • Enable ip forward: edit /etc/sysctl.conf, uncomment “#net.ipv4.ip_forward=1”.
### OLD
#net.ipv4.ip_forward=1

### NEW
net.ipv4.ip_forward=1
  • Now we should be alble to ping 192.168.0.1. To ping 166.111.142.1, we should do
 iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE
  • Set up DHCP server ( Ref)
ubuntu/gateway.txt · Last modified: 2017/05/05 15:08 by 127.0.0.1