Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Dec 1997 15:49:59 -0500 (EST)
From:      "Stan Brown" <stanb@awod.com>
To:        freebsd-questions@freebsd.com (Free BSD Questions list)
Subject:   Routeing help please.
Message-ID:  <199712252049.MAA01011@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
	I am trying to set up my FreeBSD laptop, so that it can connect to
	multiple networks and/or also call my home network via ppp. I have the
	ppp conection working as far as getting the link up, but I am strugling
	with routing. 

	When the machine boots the folowing perl script is escruted:


#!/usr/local/bin/perl

%gateway = ('205.159.77.233' =>	{
									gw	=> '205.159.77.234',
									dns	=> ['205.159.77.240',
											'208.140.99.9',
											'198.81.225.1'],
									dom => 'fas.com',
									yp => 'yes"
								},
			'222.198.37.141' =>	{
									gw	=> '222.198.37.254',
									dns	=> ['192.1.37.20'],
									dom	=> 'westvaco.com',
									yp => 'no"
								},
			'192.168.0.3 -link0' =>	{
									gw	=> '192.168.0.1',
									dns	=> ['192.168.0.1'],
									dom	=> 'westvaco.com',
									yp => 'no"
								},
);

`route delete default 2>&1 > /dev/null`;

foreach $key (keys(%gateway))
{
	$thiskey = $key;
	$up=1;
	`ifconfig ep0 inet $key netmask 0xffffff00`;
	unless (system("ping -c 1 $gateway{$key}{gw} > /dev/null"))
	{
		last;
	}
	print "Cannot ping $gateway{$key}{gw}\n";
	$up=0;
}

if($up)
{
	`route add default $gateway{$thiskey}{gw}`;
	 open RESOLVFILE, "> /etc/resolv.conf";
	 print RESOLVFILE "domain $gateway{$thiskey}{dom}\n";
	 foreach $ipnum (@{$gateway{$thiskey}{dns}})
	 {
 		print RESOLVFILE "nameserver $ipnum\n";
	 }
	 close RESOLVFILE;
	print "Configured for network $gateway{$thiskey}{dom}\n";
}
else
{
	print "Cannot find a known network\n";
	`/usr/bin/killall ypbind`;
}

	Now here is the problem. If the machine is *not* conectedd to any of
	these networks, I still get the folowing routing table:

Script started on Thu Dec 25 15:15:06 1997
# netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags     Refs     Use     Netif Expire
127.0.0.1          127.0.0.1          UH          3      203       lo0
192.168.0.1        link#5             UHLW        0        1 
205.159.77         link#5             UC          0        0 
205.159.77.234     link#5             UHLW        0        1 
205.159.77.240     link#5             UHLW        0       11 
222.198.37.254     link#5             UHLW        0        1 
# ^Dexit

Script done on Thu Dec 25 15:15:14 1997

	Now as you can see, I have some pretty strange entries her. For each
	one of the networks that I tride I have this mysterios link#5 entry.
	route delete refuses to remove these entries. I also have a network
	entry for the last network that I tried.

	What are these entries, and how do I avoid creating them, or dlete them
	after I test for that network ?

	Thanks.

-- 
Stan Brown     stanb@netcom.com                                    770-996-6955
Factory Automation Systems
Atlanta Ga.
-- 
Look, look, see Windows 95.  Buy, lemmings, buy!   
Pay no attention to that cliff ahead...            Henry Spencer
(c) 1997 Stan Brown.  Redistribution via the Microsoft Network is prohibited.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199712252049.MAA01011>