LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-05-2011, 06:53 AM   #1
Inkit
Member
 
Registered: Feb 2011
Location: India
Distribution: Mint 10
Posts: 142

Rep: Reputation: 15
How to share internet connection through a crossover cable.


Hello everyone,

I use Linux Mint 10 and have been on Linux for about a year now. I'm no expert, but I can sort of find my way around. My problem is that I am not able to set up a LAN and share my internet connection through a crossover cable. I have a USB 3G data card for my internet connection, and getting a router for it is a mite expensive. I have a crossover cable and searching on the net led me to believe that I could do what I want to. The only problem is that I am unable to.

I've got two desktops both on the same Mint 10 and when I connect them assign an IP address and gateway, my network manager shows that the connection is up, but I'm not able to ping the other system. I've even exited my firestarter firewall in case that was what was causing the problem, but I've not found a solution as yet.
My knowledge of networking is at that dangerous stage where I know very little, but think I know a lot. What I've learnt about networking I've learned over the past one month when looking around for solutions to my problem but my basic understanding leaves a lot to be desired. I would be very grateful if anyone could help me out with my problem here.

Regards,
 
Old 03-05-2011, 07:14 AM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
There are a few pieces to this solution

Basic connectivity:
- connect the pc's with a crossover cable, ensure the link is actually up with ethtool
- disable firewalls on both machines (while testing)
- ensure both machines are on the same network, if you're not clear on IP networking try 192.168.0.5 and 192.168.0.6 with a 255.255.255.0 subnet mask
- they should be able to ping each other

Let us know once this is working and we can move on to the next part

cheers
 
1 members found this post helpful.
Old 03-05-2011, 08:15 PM   #3
Inkit
Member
 
Registered: Feb 2011
Location: India
Distribution: Mint 10
Posts: 142

Original Poster
Rep: Reputation: 15
Hi Kbp,

Followed instructions and am able to ping the other system. The IP's assigned are as suggested by you.
 
Old 03-06-2011, 06:33 AM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Great ... now we need to configure one of the machines as a router, the one with the 3g usb dongle.

- edit /etc/sysctl.conf, set 'net.ipv4.ip_forward = 1'
- enable ip forwarding, 'sysctl -p'
- enable NAT via iptables, 'iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE'
(I'm guessing that your Internet connection is ppp0, replace if incorrect)
- save iptables settings, 'service iptables save'
- in Network Manager ensure the Internet connection is set to connect automatically and is "Available to all users" (this means you won't have to log on to this machine to make the connection active)
- Make a note of the dns settings your router pc picks up when it's connected to the Internet, try looking in /etc/resolv.conf.

On the second (client) machine:
- set the default gateway to be the machine above
- set the dns settings in /etc/resolv.conf to those you noted down above.

This is a pretty basic setup which should work, you can make it a lot cleaner with DHCP, DNS and other stuff but considering you only have the 2 pc's it's probably not worth it.

I use Fedora so if any of the commands don't work or the files aren't there just let me know.

cheers

Last edited by kbp; 03-06-2011 at 06:34 AM.
 
Old 03-06-2011, 07:25 PM   #5
Inkit
Member
 
Registered: Feb 2011
Location: India
Distribution: Mint 10
Posts: 142

Original Poster
Rep: Reputation: 15
Hi Kbp,

Implemented all instructions till I reached
#save iptables settings, 'service iptables save'
I got an error that says
'$ sudo service iptables save

iptables: unrecognized service'
Under the assumption that this command was to save the settings, I went ahead with the rest of the instructions to see if it will work. I set the default gateway on the second machine to be the ip address of the first and when I opened the /etc/resolv.conf all I got was the line that it was generated by the network manager.
I looked in the connection information in the network manager to obtain the information, but do not know how to save this information on the second. I'd be grateful if you could take me through this once again.
 
Old 03-07-2011, 02:30 AM   #6
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
A quick search suggests that you may be able to save the iptables rules by running 'iptables-save > /etc/firewall.conf' .. but I can't guarantee it.

When the router is connected to the Internet take a look at /etc/resolv.conf ... you should see something like:

search domain.com
nameserver xxx.xxx.xxx.xxx
nameserver yyy.yyy.yyy.yyy

Type all the entries as-is on your client pc, 'sudo <your_editor_of_choice> /etc/resolv.conf'

cheers
 
1 members found this post helpful.
Old 03-07-2011, 07:08 PM   #7
Inkit
Member
 
Registered: Feb 2011
Location: India
Distribution: Mint 10
Posts: 142

Original Poster
Rep: Reputation: 15
Thanks kbp. it's working fine now. really appreciate all the help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
FC6 to win xp w/ crossover cable internet share dla-nor Linux - Networking 5 01-03-2007 10:15 PM
cisco aironet on windows and trying to share internet though crossover cable cyberwizard Linux - Networking 0 03-21-2006 05:03 PM
internet connection sharing between two computers using crossover cable farnell_mark Debian 1 06-04-2005 04:44 PM
Sharing internet connection between Slackware and XP via crossover cable islord Linux - Networking 3 01-24-2005 10:38 AM
Slackware 9, Windows XP, crossover cable and an internet connection dxdad Linux - Networking 37 11-11-2003 08:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:09 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