LinuxQuestions.org
Review your favorite Linux distribution.
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-16-2012, 11:56 AM   #1
floppy_stuttgart
Senior Member
 
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,153
Blog Entries: 5

Rep: Reputation: 107Reputation: 107
how to setup a netbook via USB GPRS as LAN-router?


Hello There,
I can connect my samsung nc10 netbook to the net with an USB modem GPRS Huawei.
Now, I would like to connect other PCs to the net via this netbook.

How to do this?

I have a LAN cable witha 5x LAN outputs.
When I put that cable into the netbook, how can connect the other PCs into the net?
Should I start a programm on the netbook?
Which one?
How?

My preferred distro on that netbook is TinyCoreLinux (small, fast). So, I could download the required module and make a setup according your advices.

Last edited by floppy_stuttgart; 05-16-2012 at 01:09 PM.
 
Old 05-17-2012, 09:17 AM   #2
nikmit
Member
 
Registered: May 2011
Location: Nottingham, UK
Distribution: Debian
Posts: 178

Rep: Reputation: 34
Enable ip forwarding, configure nat and any firewall rules you might want, install a default route on all connected machines pointing at the internal interface of the netbook and you are done.

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

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

ip route add default via 1.2.3.4 for a linux host
route add 0.0.0.0 mask 0.0.0.0 1.2.3.4 for a windows host, in command prompt - not sure what the gui alternative is
1.2.3.4 should obv be replaced with yor internal address on the netbook.
 
Old 09-02-2012, 06:57 AM   #3
floppy_stuttgart
Senior Member
 
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,153

Original Poster
Blog Entries: 5

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by nikmit View Post
echo 1 > /proc/sys/net/ipv4/ip_forward
THANKS for the answer.
So, now (a bit time since I started that thread.. sorry) I have to make it running.

I made till now:
- boot my samsung nc10 plus via SD card and TinyCoreLinux 4.6
- goes into the net via GPRS USB (Huawei modem) via usb_modeswitch
- sudo su in a terminal
- echo 1 > /proc/sys/net/ipv4/ip_forward in the same terminal
- load the application "iptables"
- On the netbook, a lo and ppp0 exists (we can see them with the command ifconfig)
"iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE" dont give any error. perhaps it works.

But now: "ip route add default via 1.2.3.4 for a linux host"
It seems I must make "route add default gw 1.2.3.4". I will test. Probably in the PC connected via LAN to the netbook.

"1.2.3.4 should obv be replaced with yor internal address on the netbook": how to see the internal address on the netbook? I will see the result of "route -n" and see if one of the adress in the output should be used instead of 1.2.3.4. I have to test.

Comments are welcome.

Last edited by floppy_stuttgart; 09-04-2012 at 01:45 PM.
 
Old 09-24-2012, 12:32 PM   #4
floppy_stuttgart
Senior Member
 
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,153

Original Poster
Blog Entries: 5

Rep: Reputation: 107Reputation: 107
It runs. And nearly finish.
My setup is:


Connection shematic
==================================================
..PC1....PC2.....PCx
...\......|....../
....\.....|...../....................netbook
.....\....|..../..............----------------------
---------------------..... I NAT Gateway Device I.........----------------
I........HUB........I------I- eth0 : 192.168.3.5 I........I Web provider I
I.....................I......I ppp0 $DEF_GW........I--------I..............I
---------------------......-----------------------........----------------

Samsung nc10 Plus...........................pinternet.interkom.com
Huawei USB GPRS modem.......................nameserver 8.8.8.8
broadcast 192.168.3.255.....................nameserver 8.8.4.4
netmask 255.255.255.0.......................www.fonic.de
gateway 10.64.64.64 = $DEF_GW

commands to be done on the netbook
=================================
tce-load -i iptables.tcz
tce-load -i iproute2.tcz
INT_DEV="eth0"
EXT_DEV="ppp0"
DEF_GW="`/sbin/ifconfig ppp0 | grep 'P-t-P' | awk '{print $3}' | sed -e 's/.*://'`"
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
sudo /sbin/ifconfig eth0 192.168.3.5 broadcast 192.168.3.255 netmask 255.255.255.0
echo dont use 192.168.3.5 for the PCs IP but another like 192.168.3.1 or 2 or 7 ..
sudo /sbin/ifconfig eth0 up
sudo iptables -F
sudo iptables -X
sudo iptables -t nat -F
sudo iptables -t nat -X
sudo iptables -P INPUT ACCEPT
sudo iptables -P OUTPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -A FORWARD -i $INT_DEV -o $EXT_DEV -j ACCEPT
sudo iptables -t nat -A POSTROUTING -o $EXT_DEV -j MASQUERADE
sudo iptables -A FORWARD -i $EXT_DEV -o $INT_DEV -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo route del default
sudo route add default gw $DEF_GW


commands to be done on one PC
=================================
sudo ifconfig eth0 192.168.3.1 broadcast 192.168.3.255 netmask 255.255.255.0
sudo route add default gw 192.168.3.5
echo 192.168.3.5 is the default gateway for eth0 of the netbook router
echo 192.168.3.1 is the IP of the PC you are working on

Attention: the same resolv.conf must be used on PC and netbook.
resolv.conf pinternet.interkom.com
nameserver 8.8.8.8
nameserver 8.8.4.4


Place for improvement: the firewall caracteristics.

a) ping -c 4 www.google.de say: 58% of the package are lost; it is slow. Could a setup make it quicker?
b) how to avoid a resolv.conf in the PCs attached at the netbook?

Last edited by floppy_stuttgart; 09-24-2012 at 01:38 PM.
 
  


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
[SOLVED] Slackware router: lan eth1 works, lan eth2 doesnt! Iptables config issue slugman Linux - Networking 2 06-21-2011 01:37 AM
Setting up a simple, LAN-to-LAN router Phaethar Linux - Networking 3 09-09-2010 04:33 AM
LAN setup (no hardware router) on SuSE 9.1 onthos Linux - Networking 0 10-19-2005 06:41 PM
Routing LAN -> WAN -> LAN with unhelpful router synx13 Linux - Networking 2 06-14-2004 02:35 PM
ADSL Router + Linux Router + LAN = HELP!!! linuxlois Linux - General 2 09-16-2003 08:24 AM

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

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