LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-10-2007, 09:08 AM   #1
anindyanuri
Member
 
Registered: Jan 2005
Location: India
Distribution: Kubuntu Gutsy
Posts: 450

Rep: Reputation: 30
Arrow Sharing internet over small (2machines) LAN


I have just installed fedora core 5 in a machine (referred as M-5 hereinafter), and fedora core 6 (referred as M-6) in another machine. Both of these machines are connected directly with a crossover cable. I want to share my internet connection over my two machines network. The M-6 have two NICs, one is connected with a DSL (dynamic IP) internet connection (eth0), and the other NIC (eth1) is directly connected with the other machine's (M-5) NIC (eth0) with that corssover cable.

The file /etc/sysconfig/network for M-6 added with the following string,
Code:
GATEWAYDEV=ppp0
and the same file for M-5 added with
Code:
GATEWAY=192.168.0.1 //(which is the IP address of eth1 of M-6)
It can be mentioned here that I can ping well between the machines. I also changed /etc/sysctl.conf file, from net.ipv4.ip_forward=0 to net.ipv4.ip_forward=1.

Masquerade the internet connection,
Code:
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -A FORWARD -s 192.168.0.0/24 -j ACCEPT
iptables -A FORWARD -d 192.168.0.0/24 -j ACCEPT
iptables -A FORWARD -s ! 192.168.0.0/24 -j DROP
saved the file
Code:
service iptable save
restarted network and iptables.

Still I am not getting net connection to the other machine. Please guide me, what mistake I am doing to share the internet connection, treating me a newbie.

Thanks in advance.
 
Old 01-10-2007, 09:22 AM   #2
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
I think you must have forgot to mention your dns servers in M5's /etc/resolv.conf. Copy back your dns server entries from M6 & specify in M5.
 
Old 01-10-2007, 09:35 AM   #3
anindyanuri
Member
 
Registered: Jan 2005
Location: India
Distribution: Kubuntu Gutsy
Posts: 450

Original Poster
Rep: Reputation: 30
Thank you amit for your prompt reply.

Yes, I now filled up the nameservers in /etc/resolv.conf file in M-5. Restarted the M-5.

Still no help.

Also for your information,

Though I am able to ping from my M-5 to 192.168.0.1 (M-6's 2nd NIC or eth1) but cannot ping to nameserver from M-5.

Last edited by anindyanuri; 01-10-2007 at 09:46 AM.
 
Old 01-10-2007, 09:43 AM   #4
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
@ M6,
Kindly post the complete output of:
Code:
#iptables -nvL
&
Code:
cat /proc/sys/net/ipv4/ip_forward
 
Old 01-10-2007, 09:53 AM   #5
anindyanuri
Member
 
Registered: Jan 2005
Location: India
Distribution: Kubuntu Gutsy
Posts: 450

Original Poster
Rep: Reputation: 30
@M-6 o/p of iptables -nvL
Code:
Chain INPUT (policy ACCEPT 3627 packets, 2403K bytes)
 pkts bytes target     prot opt in     out     source               destination         
  607 31564 DROP       tcp  --  ppp+   *       0.0.0.0/0            0.0.0.0/0           tcp dpts:0:1023 
    2   156 DROP       udp  --  ppp+   *       0.0.0.0/0            0.0.0.0/0           udp dpts:0:1023 
  200 10656 DROP       tcp  --  ppp+   *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x17/0x02 
   10   609 DROP       icmp --  ppp+   *       0.0.0.0/0            0.0.0.0/0           icmp type 8 

Chain FORWARD (policy DROP 63 packets, 5166 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 3805 packets, 597K bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain RH-Firewall-1-INPUT (0 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 255 
    0     0 ACCEPT     esp  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     ah   --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            224.0.0.251         udp dpt:5353 
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:631 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:631 
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:2049 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22 
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW udp dpt:137 
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW udp dpt:138 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:139 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:445 
    0     0 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited
and the o/p of cat /proc/sys/net/ipv4/ip_forward
Code:
1
 
Old 01-10-2007, 10:11 AM   #6
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
There you see, look you have been running a default iptables firewall & with this we have to allow packets to traverse through the FORWARD chain (NATed packets exclusively)- because right now all the packets are being dropped. Wait i had already replied to one same query. I'll search its link & pass you on.
 
Old 01-10-2007, 10:18 AM   #7
anindyanuri
Member
 
Registered: Jan 2005
Location: India
Distribution: Kubuntu Gutsy
Posts: 450

Original Poster
Rep: Reputation: 30
Yes, please, I am waiting for your reply.
 
Old 01-10-2007, 10:25 AM   #8
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
Last two post of this thread are the one's for you; Read the complete thread & replace the values as per your setup & then repost.
http://www.linuxquestions.org/questi...d.php?t=509689
 
Old 01-10-2007, 11:08 AM   #9
anindyanuri
Member
 
Registered: Jan 2005
Location: India
Distribution: Kubuntu Gutsy
Posts: 450

Original Poster
Rep: Reputation: 30
Put off the Firewall and SELinux of Fedora in both of my machines. Now the o/p of iptables -nvL
Code:
Chain INPUT (policy ACCEPT 23 packets, 1542 bytes)
 pkts bytes target     prot opt in     out     source               destination         
   24  1196 DROP       tcp  --  ppp+   *       0.0.0.0/0            0.0.0.0/0           tcp dpts:0:1023 
    0     0 DROP       udp  --  ppp+   *       0.0.0.0/0            0.0.0.0/0           udp dpts:0:1023 
   22  1088 DROP       tcp  --  ppp+   *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x17/0x02 
    1    61 DROP       icmp --  ppp+   *       0.0.0.0/0            0.0.0.0/0           icmp type 8 

Chain FORWARD (policy DROP 63 packets, 4284 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 15 packets, 1410 bytes)
 pkts bytes target     prot opt in     out     source               destination
 
Old 01-10-2007, 11:12 AM   #10
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
What happnd ? Why aint you did the way i have mentioned in that thread ?
Have you removed that script (default one) ? Your FORWARD chain default policy is still drop.
 
Old 01-10-2007, 07:24 PM   #11
anindyanuri
Member
 
Registered: Jan 2005
Location: India
Distribution: Kubuntu Gutsy
Posts: 450

Original Poster
Rep: Reputation: 30
Amit,
it was just a try to stopping the firewall and SELinux. Though, from the out put, it is clear that I was not right, stopping the firewall and SELinux. I'll let you know the result of the thread you have given to me in the evening (after returning from my office).

Last edited by anindyanuri; 01-10-2007 at 07:28 PM.
 
Old 01-11-2007, 08:00 AM   #12
anindyanuri
Member
 
Registered: Jan 2005
Location: India
Distribution: Kubuntu Gutsy
Posts: 450

Original Poster
Rep: Reputation: 30
Good evening Amit,

I have added the following lines in /etc/sysconfig/iptables file
Code:
-A RH-Firewall-1-INPUT -s 192.168.1.0/24 -p tcp -m multiport --dports 53,443,80 -j ACCEPT
-A RH-Firewall-1-INPUT -s 192.168.1.0/24 -p udp --dport 53 -j ACCEPT
then, restarted iptables.

Now, the extract of
Code:
# /sbin/iptables -nvL
Chain INPUT (policy ACCEPT 20 packets, 3212 bytes)
 pkts bytes target     prot opt in     out     source               destination         
   44  2264 DROP       tcp  --  ppp+   *       0.0.0.0/0            0.0.0.0/0           tcp dpts:0:1023 
    0     0 DROP       udp  --  ppp+   *       0.0.0.0/0            0.0.0.0/0           udp dpts:0:1023 
    5   288 DROP       tcp  --  ppp+   *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x17/0x02 
    0     0 DROP       icmp --  ppp+   *       0.0.0.0/0            0.0.0.0/0           icmp type 8 

Chain FORWARD (policy DROP 82 packets, 5640 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 20 packets, 1520 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain RH-Firewall-1-INPUT (0 references)
 pkts bytes target     prot opt in     out     source               destination         
  901 2991K ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 255 
    0     0 ACCEPT     esp  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     ah   --  *      *       0.0.0.0/0            0.0.0.0/0           
   15  2195 ACCEPT     udp  --  *      *       0.0.0.0/0            224.0.0.251         udp dpt:5353 
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:631 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:631 
    0     0 ACCEPT     tcp  --  *      *       192.168.1.0/24       0.0.0.0/0           multiport dports 53,443,80 
    0     0 ACCEPT     udp  --  *      *       192.168.1.0/24       0.0.0.0/0           udp dpt:53 
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:2049 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22 
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW udp dpt:137 
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW udp dpt:138 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:139 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:445 
    0     0 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited
I tried to ping to my nameserver from the M-5, but it is not pinging the nameserver.
Now what?
 
Old 01-11-2007, 12:13 PM   #13
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
Anindyanuri,
1. You got to modify those network entries. Those were configured for that thread & since you are not using 192.168.1.x network, you should replace it with your own.
2. Make sure that you do run that NATing rule as well for masquerading (specified in your own first post).

For your network these settings would be,
Code:
-A RH-Firewall-1-INPUT -s 192.168.0.0/24 -p tcp -m multiport --dports 53,443,80 -j ACCEPT
-A RH-Firewall-1-INPUT -s 192.168.0.0/24 -p udp --dport 53 -j ACCEPT
You should not make a practice of directly editing that file.. infact you should always use iptables-save & iptables-restore for the same.
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet sharing with one lan adapter mlin Linux - Networking 5 05-07-2009 02:10 AM
Best internet traffic shaping for small lan zatys Linux - Networking 0 02-13-2006 03:06 AM
setting up internet in small LAN lukalinuix Slackware 8 02-10-2004 06:28 AM
Internet Sharing through Lan varunbihani Linux - Software 8 07-20-2003 08:47 AM
small network RH 8.0 without internet sharing guanyu Linux - Networking 0 11-05-2002 03:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration