LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   IP Masquerading (https://www.linuxquestions.org/questions/linux-networking-3/ip-masquerading-30913/)

kwigibo 09-21-2002 06:33 PM

IP Masquerading
 
Hi trying to setup IP Masquerading, and it isn't working. This is what is on the router.

Code:

[root@localhost root]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:30:BD:09:4E:A0
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:625 errors:0 dropped:0 overruns:0 frame:0
          TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:42344 (41.3 Kb)  TX bytes:2164 (2.1 Kb)
          Interrupt:9 Base address:0xf000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:213 errors:0 dropped:0 overruns:0 frame:0
          TX packets:213 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:21784 (21.2 Kb)  TX bytes:21784 (21.2 Kb)

ppp0      Link encap:Point-to-Point Protocol
          inet addr:139.86.23.197  P-t-P:139.86.23.1  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:569 errors:1 dropped:0 overruns:0 frame:0
          TX packets:564 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:268790 (262.4 Kb)  TX bytes:155934 (152.2 Kb)

[root@localhost root]# route -n
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
139.86.23.1    0.0.0.0        255.255.255.255 UH    0      0        0 ppp0
192.168.0.0    0.0.0.0        255.255.255.0  U    0      0        0 eth0
127.0.0.0      0.0.0.0        255.0.0.0      U    0      0        0 lo
0.0.0.0        139.86.23.1    0.0.0.0        UG    0      0        0 ppp0
[root@localhost root]# ipchains -L
Chain input (policy ACCEPT):
Chain forward (policy DENY):
target    prot opt    source                destination          ports
MASQ      all  ------  192.168.0.0          anywhere              n/a
MASQ      all  ------  192.168.0.0          anywhere              n/a
Chain output (policy ACCEPT):
[root@localhost root]#



Here is the stuff for the other computer
Code:

[root@localhost root]# ssh 192.168.0.2
root@192.168.0.2's password:
Last login: Mon Sep 23 09:31:23 2002 from fred.dj.com
[root@fred root]# route -n
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
192.168.0.0    0.0.0.0        255.255.255.0  U    0      0        0 eth0
127.0.0.0      0.0.0.0        255.0.0.0      U    0      0        0 lo
0.0.0.0        192.168.0.1    0.0.0.0        UG    0      0        0 eth0
[root@fred root]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:00:E8:DD:7F:E1
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:939 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1386 errors:0 dropped:0 overruns:0 carrier:0
          collisions:4 txqueuelen:100
          RX bytes:85306 (83.3 Kb)  TX bytes:168464 (164.5 Kb)
          Interrupt:9 Base address:0xdc00

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:13125 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13125 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:930109 (908.3 Kb)  TX bytes:930109 (908.3 Kb)

[root@fred root]# ipchains -L
Chain input (policy ACCEPT):
Chain forward (policy ACCEPT):
Chain output (policy ACCEPT):
[root@fred root]#

Thanks

AltF4 09-21-2002 06:47 PM

try enabling forwarding in your kernel somewhere in your init.d *.rc files

# echo "Enabling IP forwarding"
# echo "1" > /proc/sys/net/ipv4/ip_forward

kwigibo 09-21-2002 07:12 PM

yeah I did that echo command. But still cant access the internet on the other computer. Does the above output look right?

AltF4 09-21-2002 07:46 PM

looks ok to me (except it shows up twice)

what commands did you use to set up masquerading ?

more infos: http://www.tldp.org/HOWTO/IP-Masquerade-HOWTO/

-------------------
# sample script
# enable ip forwarding in kernel
echo 1 > /proc/sys/net/ipv4/ip_forward
# flush rules
ipchains -F
ipchains -P forward DENY
# hide internal net behind ppp0
ipchains -A forward -i ppp0 -s 192.168.0.0/255.255.255.0 -j MASQ
------------


All times are GMT -5. The time now is 08:39 AM.