From owner-freebsd-questions Thu Apr 8 22: 6:50 1999 Delivered-To: freebsd-questions@freebsd.org Received: from cc942873-a.ewndsr1.nj.home.com (cc942873-a.ewndsr1.nj.home.com [24.2.89.207]) by hub.freebsd.org (Postfix) with ESMTP id D468614E25 for ; Thu, 8 Apr 1999 22:06:45 -0700 (PDT) (envelope-from cjc@cc942873-a.ewndsr1.nj.home.com) Received: (from cjc@localhost) by cc942873-a.ewndsr1.nj.home.com (8.9.3/8.8.8) id AAA06633 for freebsd-questions@FreeBSD.ORG; Fri, 9 Apr 1999 00:51:30 -0400 (EDT) (envelope-from cjc) From: "Crist J. Clark" Message-Id: <199904090451.AAA06633@cc942873-a.ewndsr1.nj.home.com> Subject: Using 'route' on Subnets To: freebsd-questions@FreeBSD.ORG (FreeBSD Questions) Date: Fri, 9 Apr 1999 00:51:30 -0400 (EDT) Reply-To: cjclark@home.com X-Mailer: ELM [version 2.4ME+ PL40 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I had some wicked routing troubles earlier today. At my job, we are planning a move from a C class net with 32 address (30 usable) subnets to having the whole C class on one LAN. This is part of a move from some thin net legs to all 100BaseT. To do the switch, we are planning to move from one C class net to a second. This way, we can more easily do the move gradually. In order to maintain continuity in services, some machines will be aliased to their new address. I was getting a start on the aliasing today on our mailserver, a FreeBSD 2.2.8-STABLE box, when I had some ugly problems that forced me to do my first ever reboot of the machine (except for kernel upgrades and one time we unplugged the thing to move it). I accidently screwed up entering the netmask of the alias so I ended up with the effect of, # ifconfig ex0 inet 10.0.0.7 netmask 255.255.255.224 # ifconfig ex0 inet 10.0.1.7 netmask 255.255.254.0 alias Now this really started to mess things up. First, I was telneted into the mailserver doing this from 10.0.0.70. The mailserver got the idea that the machine I was on should be on the same LAN and started ARPing for it, hanging my connections. I quickly realized the problem and got to the console to remove the alias. However, removing the alias did _not_ reset the routes. The routing table was still, # netstat -rn Routing tables Internet: Destination Gateway Flags Refs Use Netif Expire default 10.0.0.30 UGSc 2 0 ex0 127.0.0.1 127.0.0.1 UH 1 1009 lo0 10.0.0/27 link#2 UC 0 0 10.0.0/23 link#2 UC 0 0 10.0.0.1 0:e0:1e:3e:40:0 UHLW 1 0 ex0 1139 10.0.0.2 8:0:69:7:40:16 UHLW 2 114 ex0 1144 10.0.0.7 0:aa:0:6f:d7:28 UHLW 1 26 lo0 10.0.0.30 0:60:8c:38:c4:82 UHLW 2 0 ex0 1137 10.0.0.41 link#2 UHRLW 1 7 10.0.0.70 link#2 UHRLW 1 7 ex0 3 10.0.0.148 link#2 UHRLW 1 7 ex0 16 I tried to, # route flush But that only would remove the 'default' entry. I could kill each of the individual hosts, 10.0.0.41, 10.0.0.70, and 10.0.0.148, but I could not find a way to kill the network entry 10.0.0/23 (or the other). I just could not get rid of 'link#2,' whatever that is, and get the routing table rebuilt without the bad netmask. I tried (as mostly shots in the dark), # ifconfig ex0 -link[0-2] (no errors, no effect) # route delete 10.0.0/23 (an error that host does not exist) # route delete -net 10.0.0/23 (an error that net does not exist) # ifconfig ex0 down (no effect on routes) # ifconfig ex0 delete (all IPs gone, no change in routing) . . (A few dozen other things and variations on the ones above) . I could think of no other ways to try to manipulate the table and since the routing table is in the kernel, the only way to kill and restart the routing was a reboot (that I could see). What should I have done to fix this? Is there a problem in the kernel or the ex0 driver? Or was my screw up with the netmask so damaging that there is no real way to recover? How does one enter networks that don't end at byte bounaries into route commands? What exactly does 'link#2' mean above? Thanks for any help. Complete answers or pointers to documentation are always appreciated (I've been trying to dig into O'Rielly's _TCP/IP Network Administration_ (the crab book) all night). P.S. If I had gotten the netmask right, 255.255.255.0, the first time, would things have worked out alright? I'm scared to try it now even though I think it should not be a problem. -- Crist J. Clark cjclark@home.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message