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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
03-05-2011, 07:53 AM
|
#1
|
Member
Registered: Feb 2011
Location: India
Distribution: Mint 10
Posts: 142
Rep:
|
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,
|
|
|
03-05-2011, 08:14 AM
|
#2
|
Senior Member
Registered: Aug 2009
Posts: 3,790
|
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.
|
03-05-2011, 09:15 PM
|
#3
|
Member
Registered: Feb 2011
Location: India
Distribution: Mint 10
Posts: 142
Original Poster
Rep:
|
Hi Kbp,
Followed instructions and am able to ping the other system. The IP's assigned are as suggested by you.
|
|
|
03-06-2011, 07:33 AM
|
#4
|
Senior Member
Registered: Aug 2009
Posts: 3,790
|
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 07:34 AM.
|
|
|
03-06-2011, 08:25 PM
|
#5
|
Member
Registered: Feb 2011
Location: India
Distribution: Mint 10
Posts: 142
Original Poster
Rep:
|
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.
|
|
|
03-07-2011, 03:30 AM
|
#6
|
Senior Member
Registered: Aug 2009
Posts: 3,790
|
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.
|
03-07-2011, 08:08 PM
|
#7
|
Member
Registered: Feb 2011
Location: India
Distribution: Mint 10
Posts: 142
Original Poster
Rep:
|
Thanks kbp. it's working fine now. really appreciate all the help.
|
|
|
All times are GMT -5. The time now is 03:03 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|