Differences between revisions 3 and 4
Deletions are marked like this. Additions are marked like this.
Line 10: Line 10:
Modify {{{/etc/sysctl.conf}}} Ensure that machine has 2 NIC.

In this guide eth0 is external and eth1 is internal

Modify {{{/etc/sysctl.conf}}}, uncomment:
{{{
net.ipv4.ip_forward=1
}}}
Modify {{{/etc/rc.local}}}, add:
{{{
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth1 -j ACCEPT
}}}
Execute
{{{
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth1 -j ACCEPT
ifconfig eth1 <private address>
}}}

Setting up NAT

Current NAT server is natrium.club.cc.cmu.edu

Setting up NAT server/gateway

See https://wiki.club.cc.cmu.edu/org-auth/ccwiki/natrium.club.cc.cmu.edu

See http://www.bctes.com/nat-linux-iptables.html

Ensure that machine has 2 NIC.

In this guide eth0 is external and eth1 is internal

Modify /etc/sysctl.conf, uncomment:

net.ipv4.ip_forward=1

Modify /etc/rc.local, add:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth1 -j ACCEPT

Execute

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth1 -j ACCEPT
ifconfig eth1 <private address>

Adding machines to NAT

Assuming you want to add br1 to natrium as 10.0.2.2

Temporary

ifconfig eth1 10.0.2.2 netmask 255.255.255.0 broadcast 10.0.2.255
route add default gw 10.0.2.1 br1

Permanent

Modify br<interface> in /etc/network/interfaces:

auto br<interface>
iface br<interface> inet static
        address 10.0.2.2 
        netmask 255.255.255.0
        network 10.0.2.0
        broadcast 10.0.2.255
        gateway 10.0.2.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 128.237.157.12 128.237.157.14
        dns-search club.cc.cmu.edu
        bridge_ports eth<interface#>

Services/NAT (last edited 2013-10-27 04:27:49 by scgruber@CLUB.CC.CMU.EDU)