Unix Technical Forum

[newbie] internet sharing / iptables

This is a discussion on [newbie] internet sharing / iptables within the Linux Operating System forums, part of the Unix Operating Systems category; --> hi I need some help to configure my local network in order to share internet connection between a linux ...


Go Back   Unix Technical Forum > Unix Operating Systems > Linux Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-17-2008, 05:38 PM
marcos
 
Posts: n/a
Default [newbie] internet sharing / iptables

hi
I need some help to configure my local network in order to share
internet connection between a linux machine (PC1) and a winXP laptop.
I don't understand anything to networks, and I've been trying for days,
bu no way... Please help !

My linux box (PC1) : Debian Sid, ker2.4.22, connected to the internet.
It works fine (web browsing, mail, etc...)

My laptop (PC2) : winXP pro, connected to PC1 by a wifi network. This
LAN seems to be working : I can ping PC1 from PC2 (and PC1 > PC2 too), I
can ping the DNS of my provider from the laptop too. But I cannot use
the web (IExplorer won't find anything).

I don't know if the problem comes from the winXP network configuration
or from the Debian configuration of my PC1 box.
I've tried to use iptables for the ip-forwarding, but I don't understand
very well how it works.

Can you help me ?

Here is my configuration on PC1 :
------------------------------------------------------------

#/etc/network/interfaces
auto lo
iface lo inet loopback
#automatic starting/stopping "iptables" rules
pre-up /etc/network/if-pre-up.d/iptables-start.sh
post-down /etc/network/if-post-down.d/iptables-stop.sh

# ethernet card, connected to the internet
auto eth0
iface eth0 inet dhcp

# usb wlan adapter netgear MA101(B)
auto eth1
iface eth1 inet static
address 192.168.0.1
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
# activation of IP forwarding IP
up echo "1" > /proc/sys/net/ipv4/ip_forward
------------------------------------------------------------------

#****** /etc/network/if-pre-up.d/iptables-start.sh
#!/bin/sh
# starting "iptables" rules

iptables -F
iptables -t nat -F

iptables -P INPUT DROP

iptables -P FORWARD ACCEPT

iptables -P OUTPUT ACCEPT

iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

iptables -A INPUT -p tcp --dport 80 -j ACCEPT

iptables -A INPUT -p icmp -j ACCEPT

iptables -A INPUT -p igmp -j ACCEPT

iptables -A INPUT -i lo -j ACCEPT

iptables -A INPUT -j REJECT

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination
192.168.0.2:80
-------------------------------------------------------------------

this is what I get from the ipconfig -a command :

eth0 Lien encap:Ethernet HWaddr 00:20:18:B8:948
inet adr:82.66.118.57 Bcast:82.66.118.255 Masque:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:499 errors:0 dropped:0 overruns:0 frame:0
TX packets:317 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:100
RX bytes:380220 (371.3 KiB) TX bytes:24224 (23.6 KiB)
Interruption:10 Adresse de base:0xb800

eth1 Lien encap:Ethernet HWaddr 00:09:5B:4B:2D:B0
inet adr:192.168.0.1 Bcast:192.168.0.255 Masque:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:162 errors:0 dropped:0 overruns:0 frame:0
TX packets:87 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:100
RX bytes:14922 (14.5 KiB) TX bytes:7881 (7.6 KiB)

lo Lien encap:Boucle locale
inet adr:127.0.0.1 Masque:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:807 errors:0 dropped:0 overruns:0 frame:0
TX packets:807 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:0
RX bytes:48398 (47.2 KiB) TX bytes:48398 (47.2 KiB)

--------------------------------------------------------------

here is what I get from the route -n command:

Table de routage IP du noyau
Destination Passerelle Genmask Indic Metric Ref Use Iface
82.66.118.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
0.0.0.0 82.66.118.254 0.0.0.0 UG 0 0 0 eth0

-----------------------------------------------------------------

Here is my winXP network configuration :

Utiliser l'adresse IP suivante:
adresse IP: 192.168.0.2
masque de sous reseau: 255.255.255.0
passerelle par defaut: 192.168.0.1

Utiliser l'adresse de serveur DNS suivante:
serveur DNS prefere: 212.27.32.176
serveur DNS auxiliaire: 212.27.32.177

sorry, it is in french
I guess 'masque de sous reseau' stands for 'submask'
'passerelle par défaut' stands for 'default gateway'
'serveur DNS prefere' stands for 'primary DNS'
'serveur DNS auxiliaire' stands for 'secondary DNS'

I apologize for my bad english

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:04 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com