April 24, 2024, 03:41:30 AM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: sharing internet from linux machine ?  (Read 5145 times)

Offline joydeep

  • Linux Noob !
  • *
  • Posts: 21
sharing internet from linux machine ?
« on: January 12, 2007, 01:18:53 PM »
Dear list,

I am in a critical network problem with a linux box and asking help from the group.
let me discuss the actual situation. I have a load balancong router called linksys RV042.
this router has 2 wan port. now there is a ADSL modem come from one  of my isp. I have set the modem as a auto dialer so powering up the modem automatically dial up the isp. one connection from this modem has come to one of the wan port of my linksys load balancing router. there is no problem to get the net connection

another isp is providing 24online connection where a lan card is required to dialup the isp.
I have a linux PC which have 2 lan card. so I dial up the isp using one lan card and getting the net connection in this linux pc. now I like to use the 2nd lan card of this pc to fed this
internet connection to the other free wan port of the load balancing router. and here is the actual problem I am facing. So could one kindly suggest how to use this 2nd lan card to fed the internet into the wan port of  the load balancing router

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
sharing internet from linux machine ?
« Reply #1 on: January 12, 2007, 05:24:56 PM »
That is not a problem, I think your other ISP is some WIFI or oen which using authentication for using the internet !

I dont' have much idea about that linksys loadbalanced router but you can easily do that .

All you need to do is apply a method of internet sharing linux available among few..  
One I have mentioned is this oen -->
http://www.linuxsolved.com/forums/ftopic115.html

Its particularly doing port forwarding.. Just do that and then if allowed in your router, set gateway, DNS accordingly in the router (Gateway must be IP of eth1 or linux box and DNS as per provided by that ISP)

Offline joydeep

  • Linux Noob !
  • *
  • Posts: 21
sharing internet from linux machine ?
« Reply #2 on: January 13, 2007, 07:37:56 AM »
Thanks a lot for your response. the link which u have mentioned; I have tried last week but without any success. let me give u more details. may be u can suggest where I am doing wrong. first see my setting below

isp 1--->[ eth0(used to dial isp1) linux eth1]---> [wan2 port of router] -----> [hub]--> client PCs

now here is the setting of eth1
-----------------------------------------------------
ip ---> 192.168.0.2
mask  --> 255.255.255.0
gateway --> gateway of eth0
dns   ----> dns of eth0


here is the setting of wan2 port of load balancing router
-------------------------------------------------------------------------------------------

ip ----> 192.168.0.114
mask  ----> 255.255.255.0
gateway  ----> 192.168.0.2 (ip of the linux lan card)
dns    ------> 192.168.0.2

Here is the setting of the hub section of the router
---------------------------------------------------------------------------------
ip ----> 192.168.1.2
mask  ---> 255.255.255.0
dual wan  ----> wan1  wan2

wan1 and wan2 has their own setting as I also mentioned the wan2 above.

clients pc settings
-----------------------------------
DHCP enable.  bcoz the load balancing router has DHCP server inbuilt
gateway  ---> 192.168.1.2


here is the script I use in my suse 10

iptables --flush -t nat
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward

after executing the script I have tried from the clients pc with out success.
Could any one kindly point out my mistake ?
please note I am getting the internet from the linux pc which dialup isp1

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
sharing internet from linux machine ?
« Reply #3 on: January 14, 2007, 04:41:22 PM »
Code: [Select]
now here is the setting of eth1
-----------------------------------------------------
ip ---> 192.168.0.2
mask --> 255.255.255.0
gateway --> gateway of eth0
dns ----> dns of eth0

Here leaev gateway and DNS blank & let me know.

Offline joydeep

  • Linux Noob !
  • *
  • Posts: 21
sharing internet from linux machine ?
« Reply #4 on: January 15, 2007, 05:05:11 AM »
well Ricky,
I am using suse 10. For both the card it automatically take ( from yast) the same nameserver and GW. I have also tried to blank the GW ans nameserver of eth1 but then
found that it automatically clears the dns and GW from the configuration of eth0 too.

so here eth1 is automatically taking the same DNS and GW as eth0.

can u seggest to fix it ?

Offline joydeep

  • Linux Noob !
  • *
  • Posts: 21
sharing internet from linux machine ?
« Reply #5 on: January 15, 2007, 10:10:06 AM »
FINALLY THE SUCCESS !!!  in router configuration I have configured the wan2 which is connected with linux box as

wan2 configuration
----------------------------------
  obtain ip automatically

and it solved my problem..

thanks to all responders for giving me the concepts and showing ways which
finally help me to face the success :-)

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
sharing internet from linux machine ?
« Reply #6 on: January 17, 2007, 12:19:19 PM »
I am glad it worked for you!