1 |
On Tuesday 09 May 2006 05:26, Mrugesh Karnik <mrugeshkarnik@×××××.com> |
2 |
wrote about '[gentoo-user] OT - Need help with NAT': |
3 |
> Hi, |
4 |
> |
5 |
> I have been having trouble forwarding packets using iptables on my |
6 |
> Gentoo box. I am no iptables expert. |
7 |
> |
8 |
> I connect to the internet using rp-pppoe. I use firestarter for |
9 |
> firewalling. Yesterday I installed VMware and chose host only |
10 |
> networking between the VMs. vmnet0 was bound to 192.168.128.1 and the |
11 |
> rest of the subnet being 192.168.128.0/24. |
12 |
> |
13 |
> As should be obvious by now, I need to forward packets from ppp0 to |
14 |
> vmnet0 and allow outbound packets as well. |
15 |
|
16 |
Add |
17 |
net.ipv4.conf.all.forwarding = 1 |
18 |
to |
19 |
/etc/sysctl.conf |
20 |
and apply the setting by issuing |
21 |
sysctl -p |
22 |
as root. |
23 |
|
24 |
Issue the command: |
25 |
iptables -t nat -A POSTROUTING \ |
26 |
-o ppp0 \ |
27 |
--source 192.168.128.0/24 \ |
28 |
-j MASQUERADE |
29 |
also as root. |
30 |
|
31 |
You may also want to issue: |
32 |
iptables -t mangle -A OUTPUT \ |
33 |
-p tcp \ |
34 |
--tcp-flags SYN,RST SYN \ |
35 |
-j TCPMSS --clamp-mss-to-pmtu |
36 |
and possibly |
37 |
iptables -t mangle -A OUTPUT \ |
38 |
-p tcp \ |
39 |
--tcp-flags SYN,RST SYN \ |
40 |
-j TCPMSS --clamp-mss-to-pmtu |
41 |
as root to help control packet fragmentation. |
42 |
|
43 |
I believe the iptables init script should handle saving/restoring these |
44 |
rules on reboot. |
45 |
|
46 |
I have NO IDEA how to add these iptables rules to firestarter. |
47 |
|
48 |
-- |
49 |
"If there's one thing we've established over the years, |
50 |
it's that the vast majority of our users don't have the slightest |
51 |
clue what's best for them in terms of package stability." |
52 |
-- Gentoo Developer Ciaran McCreesh |