Networking Forums

Networking Forums > Computer Networking > Linux Networking > Adding a new route

Reply
Thread Tools Display Modes

Adding a new route

 
 
robert
Guest
Posts: n/a

 
      08-28-2006, 01:43 PM
Hi all I have a simple problem:

1) I get an IP and default gw from DHCP.
2) I need to sometimes connect to an external vpn. To do this, I use a
program called pptpconfig .
3) When connecting via pptpconfig, I authenticate but the same default
gw is there. So:

original dhcp gw: 10.101.44.1
vpn gw I need to use sometimes: 192.168.2.101

So I do:

route del default gw 10.101.44.1
route add default gw 192.168.2.101

That gives me everything on the vpn, but then I don't have internate /
local lan access. How can I get both the vpn and local lan access.

Thanks!
Robert

 
Reply With Quote
 
 
 
 
Giovanni
Guest
Posts: n/a

 
      08-28-2006, 02:49 PM
robert wrote:
> Hi all I have a simple problem:
>
> 1) I get an IP and default gw from DHCP.
> 2) I need to sometimes connect to an external vpn. To do this, I use a
> program called pptpconfig .
> 3) When connecting via pptpconfig, I authenticate but the same default
> gw is there. So:
>
> original dhcp gw: 10.101.44.1
> vpn gw I need to use sometimes: 192.168.2.101
>
> So I do:
>
> route del default gw 10.101.44.1
> route add default gw 192.168.2.101
>
> That gives me everything on the vpn, but then I don't have internate /
> local lan access. How can I get both the vpn and local lan access.


You do not need to add a new default route. If pptpconfig doesn't do it
by itself add the command:
add -net 192.168.2.101 netmask 192.168.2.0 dev <device>

Ciao
Giovanni
--
A computer is like an air conditioner,
it stops working when you open Windows.
Registered Linux user #337974 < http://giovanni.homelinux.net/ >
 
Reply With Quote
 
Allen McIntosh
Guest
Posts: n/a

 
      08-28-2006, 03:19 PM
> 3) When connecting via pptpconfig, I authenticate but the same default
> gw is there. So:
>
> original dhcp gw: 10.101.44.1


pptp needs to have some way to get packets to the network at the other
end, so you need to keep this entry.

> vpn gw I need to use sometimes: 192.168.2.101

What network do you need to contact?

You really need to give us more information. Post the output of "route
-n" before and after starting pptp, and tell us a bit more about the VPN.
 
Reply With Quote
 
robert
Guest
Posts: n/a

 
      08-28-2006, 04:36 PM

Allen McIntosh escreveu:

> > 3) When connecting via pptpconfig, I authenticate but the same default
> > gw is there. So:
> >
> > original dhcp gw: 10.101.44.1

>
> pptp needs to have some way to get packets to the network at the other
> end, so you need to keep this entry.
>
> > vpn gw I need to use sometimes: 192.168.2.101

> What network do you need to contact?
>
> You really need to give us more information. Post the output of "route
> -n" before and after starting pptp, and tell us a bit more about the VPN.


To the other poster, I tried:

route add -net 192.168.2.101 netmask 255.255.255.255 dev eth0

But still had the same problem - I can't 'ping 192.168.2.93' .

Before:

/root> route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use
Iface
10.101.40.0 0.0.0.0 255.255.248.0 U 0 0 0
eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0
eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0
lo
0.0.0.0 10.101.45.1 0.0.0.0 UG 0 0 0
eth0

After pptpconfig (24.199.x.x of course fictitious) :

/root> route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use
Iface
24.199.x.x 10.101.45.1 255.255.255.255 UGH 0 0 0
eth0
192.168.2.101 0.0.0.0 255.255.255.255 UH 0 0 0
ppp0
10.101.40.0 0.0.0.0 255.255.248.0 U 0 0 0
eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0
eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0
lo
0.0.0.0 10.101.45.1 0.0.0.0 UG 0 0 0
eth0

Still can't 'ping 192.168.2.93' . The only way I can ping so far is
by:

linux(root)]
/root> route del default gw 10.101.45.1
[linux(root)]
/root> route add default gw 192.168.2.101

The only info I have on the vpn is its microsoft. Thanks for any help,
Robert

 
Reply With Quote
 
Moe Trin
Guest
Posts: n/a

 
      08-28-2006, 08:11 PM
On 28 Aug 2006, in the Usenet newsgroup comp.os.linux.networking, in article
<(E-Mail Removed) .com>, robert wrote:

>1) I get an IP and default gw from DHCP.


and that default gateway leads to the world.

>2) I need to sometimes connect to an external vpn. To do this, I use a
>program called pptpconfig .
>3) When connecting via pptpconfig, I authenticate but the same default
>gw is there. So:
>
>original dhcp gw: 10.101.44.1
>vpn gw I need to use sometimes: 192.168.2.101


OK - STOP right there. The route to the world is through 10.101.44.1.
Where does 192.168.2.101 lead to? The world? Or some very limited
number of hosts.

>route del default gw 10.101.44.1
>route add default gw 192.168.2.101
>
>That gives me everything on the vpn, but then I don't have internate /
>local lan access.


OK - look at your routing table (/sbin/route -n). You should see something
like:

[example ~]$ /sbin/route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.101.44.0 0.0.0.0 255.255.255.0 U 0 0 89948 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 388 lo
0.0.0.0 10.101.44.1 0.0.0.0 UG 0 0 2673 eth0
[example ~]$

That says that 10.101.44.0 through 10.101.44.255 is _DIRECTLY_ connected
to the eth0 interface. 127.0.0.0 through 127.255.255.255 is on the loopback
interface, AND EVERYTHING ELSE IS REACHABLE BY HANDING IT TO 10.101.44.1.
You are confusing the term 'gateway' and 'default gateway'. They are not
the same function.

>How can I get both the vpn and local lan access.


Set up the correct routes. 192.168.2.101 apparently doesn't lead to the
world, so do not tell your computer that it does. Perhaps your VPN routing
setup leads to 172.16.0.0/12 (172.16.0.0 to 172.31.255.255). Set that route
(the syntax is "/sbin/route add -net 172.16.0.0 netmask 255.240.0.0 gw
192.168.2.101"). 192.168.2.101 is _A_ gateway to some networks. A _default_
gateway is a gateway that leads to the world (really, everywhere OTHER THAN
the routes you have already defined).

Old guy
 
Reply With Quote
 
Allen McIntosh
Guest
Posts: n/a

 
      08-28-2006, 08:59 PM
> After pptpconfig (24.199.x.x of course fictitious) :
So what is it? The other end of the pptp tunnel?
>
> /root> route -n
> Kernel IP routing table
> Destination Gateway Genmask Flags Metric Ref Use
> Iface
> 24.199.x.x 10.101.45.1 255.255.255.255 UGH 0 0 0
> eth0
> 192.168.2.101 0.0.0.0 255.255.255.255 UH 0 0 0
> ppp0

This looks a bit strange. Why just one host on the other side of the
pptp tunnel?
> 10.101.40.0 0.0.0.0 255.255.248.0 U 0 0 0
> eth0
> 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0
> eth0
> 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0
> lo
> 0.0.0.0 10.101.45.1 0.0.0.0 UG 0 0 0
> eth0
>


Disclaimer: I don't use pptp. I also don't know what IP addresses are
supposed to be on the other side of your PPTP connection.

That said, at a guess, one of
route add -net 192.168.2.0/24 ppp0
or
route add -net 192.168.2.0/24 gw 192.168.2.101
might do what you want.
 
Reply With Quote
 
robert
Guest
Posts: n/a

 
      08-29-2006, 12:46 PM

Allen McIntosh escreveu:

> That said, at a guess, one of
> route add -net 192.168.2.0/24 ppp0


That's it!!! Thanks a lot Allen!

Robert

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: RTNETLINK answers: Invalid argument when adding route... help! Pascal Hambourg Linux Networking 0 11-17-2009 09:36 AM
Adding Static route moncho Windows Networking 5 04-13-2006 07:13 AM
adding static route to vmware image ... droodle Linux Networking 1 12-19-2005 03:52 PM
Adding a persistant route with a specific interface =?Utf-8?B?TVBpcnJvbmUx?= Windows Networking 3 04-07-2005 11:08 AM
Adding route to vpn based destinations - vpn not set as default gw Peter Tobin Windows Networking 7 02-26-2004 01:28 PM



1 2 3 4 5 6 7 8 9 10 11