Gentoo Archives: gentoo-user

From: Chuanwen Wu <wcw8410@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] iptables configuration problem
Date: Mon, 14 May 2007 03:36:47
Message-Id: 7797aa370705132031m40aa555bx439389552a0443d@mail.gmail.com
In Reply to: Re: [gentoo-user] iptables configuration problem by Fabio A Correa
1 2007/5/13, Fabio A Correa <facorread@×××××.com>:
2 > -----BEGIN PGP SIGNED MESSAGE-----
3 > Hash: SHA1
4 >
5 > Hello Wu,
6 >
7 > Instead of the commands you posted, you should use
8 >
9 > echo 1 > /proc/sys/net/ipv4/ip_forward
10 > iptables --table nat -A POSTROUTING -s 192.168.8.0/24 -j MASQUERADE
11 >
12 I have tried.But still not work.
13 Here is the information after execute your advice:
14 -------------------------------------------------------------------------------------------------
15 [root@localhost ~]# echo 1 > /proc/sys/net/ipv4/ip_forward
16 [root@localhost ~]# iptables --table nat -A POSTROUTING -s
17 192.168.1.0/24 -j MASQUERADE
18 [root@localhost ~]# iptables -L
19 Chain INPUT (policy ACCEPT)
20 target prot opt source destination
21
22 Chain FORWARD (policy ACCEPT)
23 target prot opt source destination
24
25 Chain OUTPUT (policy ACCEPT)
26 target prot opt source destination
27 [root@localhost ~]# iptables -L -t nat
28 Chain PREROUTING (policy ACCEPT)
29 target prot opt source destination
30
31 Chain POSTROUTING (policy ACCEPT)
32 target prot opt source destination
33 MASQUERADE all -- 192.168.1.0/24 anywhere
34
35 Chain OUTPUT (policy ACCEPT)
36 target prot opt source destination
37
38 ------------------------------------------------------------------------------
39 Then in my other PCs,I still can't ping the website outside.
40 Why?
41
42
43 > Long explanation:
44 >
45 > The first command enables the kernel to _forward_ packets from eth0 to eth1 and vice versa. To
46 > do the actual forwarding, the second command is used:
47 >
48 > - --table nat : Network address translation table.
49 > - -A POSTROUTING for altering packets as they are about to go out, after it is determined that
50 > they are to be forwarded by means of the first instruction.
51 > - -j MASQUERADE Masquerade the addresses of computer in the subnet with the address of the routing
52 > computer.
53 >
54 > The kernel takes care of the subtle details on masquerading.
55 >
56 > I hope this helps!!!
57 >
58 > - --
59 > Fabio A. Correa D.
60 >
61 > Physics Dept, Universidad Nacional, Bogota, Colombia
62 > facorread@×××××.com
63 > ffaaccdd@××××××××.uk facorread@××××××××.co
64 > My webpage and OpenPGP key at http://facorread.150m.com
65 > facorread@××××××××××.cc is not working anymore!!!
66 > -----BEGIN PGP SIGNATURE-----
67 > Version: GnuPG v1.4.6 (GNU/Linux)
68 > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
69 >
70 > iD8DBQFGRyjPYOZCB4zf2uQRAp2eAJwIYrXAQqldgZjRN0u+uDOW8t/aTgCeOQOb
71 > RTmVGHOHQQWUzVxkZomHhHo=
72 > =xvIZ
73 > -----END PGP SIGNATURE-----
74 > --
75 > gentoo-user@g.o mailing list
76 >
77 >
78 Thank you for your details!!!
79
80 --
81 wcw
82 --
83 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] iptables configuration problem Norberto Bensa <nbensa@×××.net>