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 05-30-2004, 03:28 AM   #1
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Rep: Reputation: 73
Gateway (to the internet)


After much ado, I got my local LAN working. I can see files on the other computer, etc.
But I can't connect to the net from newcomp (192.168.3.10) via oldcomp (192.168.3.9), although that is the address set as gateway.
Can anyone help? A tip about what conf files may need altering? I set things up by hand in exports, host.allow and host.deny, as I found the wizards couldn't do it right.
 
Old 05-30-2004, 04:11 AM   #2
Covel
Member
 
Registered: Oct 2003
Location: Portugal
Distribution: Gentoo
Posts: 116

Rep: Reputation: 16
If you have iptables:


#enable forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward

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

(assuming eth0 is your external nic)

I think this is enough to have internet on both computers...

You should search a bit more the forum and the internet. There are lots of how-to about this. You should also read the iptables documentation at iptables website (netfilter) and undestand how it works and set up a firewall.

I started by using some iptables rules I found on this forum. After understanding how iptables works, I changed them to fit my needs.
 
Old 05-31-2004, 04:15 AM   #3
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Original Poster
Rep: Reputation: 73
/proc/sys//net/ipv4/ipforward contains only
0

The last time I messed with iptables via LinWiz, an automatic configurer, nothing worked and the network was blocked.
If I enter the above iptables command, where does it write to? The conf file? So that I can erase it if needed!
 
Old 05-31-2004, 07:50 PM   #4
Covel
Member
 
Registered: Oct 2003
Location: Portugal
Distribution: Gentoo
Posts: 116

Rep: Reputation: 16
ip_forward should contain 1 or you wont be able to share internet. Type this to put 1 into that file

echo 1 > /proc/sys/net/ipv4/ip_forward



That iptables rule wont block anything and will be lost when rebooting. If you want to keep it you'll have to had it to an initialization script.

You can also delete it without rebooting by entering iptables -F (flush rules)
 
Old 06-01-2004, 09:10 AM   #5
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Original Poster
Rep: Reputation: 73
iptables is an executable, right? Does it read a .conf file when executed? Which file contains all the ACCEPT and REJECT and CHAINS and so on? I didn't see that in the man page, but then it is very long!
Thanks
Peter
 
Old 06-01-2004, 02:03 PM   #6
Covel
Member
 
Registered: Oct 2003
Location: Portugal
Distribution: Gentoo
Posts: 116

Rep: Reputation: 16
AFAIK, iptables doesn't read any conf file by default. You can save iptables rules to a file and then restore them with iptables-save and iptables-restore.
 
Old 06-05-2004, 12:14 AM   #7
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Original Poster
Rep: Reputation: 73
I did exactly as you said, I have a 1 in ip_forward, and entered the command
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
but, no access from the computer without a modem!
I just get "could not be found".
Got any more tips??
 
Old 06-05-2004, 07:20 AM   #8
Covel
Member
 
Registered: Oct 2003
Location: Portugal
Distribution: Gentoo
Posts: 116

Rep: Reputation: 16
Have you set the dns servers on the new computer?
 
Old 06-05-2004, 12:58 PM   #9
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Original Poster
Rep: Reputation: 73
No, I don't know if I have a DNS service running, but I'll look into it. Now, as the wife and boys aren't here, it's quiet!
But I know that on the new computer I did set the gateway to 192.168.3.9, somewhere in a wizard.
 
Old 06-05-2004, 02:11 PM   #10
Covel
Member
 
Registered: Oct 2003
Location: Portugal
Distribution: Gentoo
Posts: 116

Rep: Reputation: 16
Your ISP should have a DNS server running. The computers using the gateway must know the DNS server address or they wont be able to query it about hostnames. DNS servers translate hostnames into IP addresses.

I have a DHCP server running on my gateway that automaticaly configures all computers' network interfaces with this info. You can learn how to configure something like this or you can add a fixed address to each computer.

But I'm not sure this is your only problem. To test this you can try pinging an IP address from your new computer. Try

ping 64.179.4.149

This is linuxquestions.org ip address. If you get an answer, you can connect to the internet. Now try

ping www.linuxquestions.org

If this time you don't get any answer, you're problem is the name resolution, ie, you have to configure your new computer with the DNS server IP address.
 
Old 06-05-2004, 02:29 PM   #11
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Original Poster
Rep: Reputation: 73
My comps have fixed addresses
oldcomp is 192.168.3.9
newcomp is 192.168.3.10

I told the newcomp to use oldcomp as a gateway, using the number, not the name.
ping 64.179.4.149 is stalled at this moment, so I guess it can't reach outside. I'll have to kill it.
With just two comps, I don't think I need dhcp, although I have set it up, once.
Ping is still stalled, I'll get back to you,
Thanks Peter
 
Old 06-05-2004, 04:17 PM   #12
Covel
Member
 
Registered: Oct 2003
Location: Portugal
Distribution: Gentoo
Posts: 116

Rep: Reputation: 16
Don't forget that iptables loses it's rules when you reboot.

If you can't ping, I may not be able to help you anymore Maybe someone else has more ideas
 
  


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
Going to the Internet by a gateway Jose Santos Linux - Newbie 1 05-26-2005 11:43 AM
Internet gateway recommendations Quatro Linux - Newbie 8 07-27-2004 04:49 PM
Gateway for internet mfeoli Linux - Newbie 4 01-19-2004 11:14 AM
INternet Gateway lil213 Linux - Networking 0 11-06-2003 02:44 PM
Internet gateway fxlee Linux - Networking 1 01-06-2002 10:33 AM

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

All times are GMT -5. The time now is 10:34 AM.

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