From owner-freebsd-net@freebsd.org Thu Feb 15 18:09:48 2018 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E8E4F0D7EC for ; Thu, 15 Feb 2018 18:09:48 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2611C86DF4 for ; Thu, 15 Feb 2018 18:09:47 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w1FI9hfQ058741; Thu, 15 Feb 2018 10:09:44 -0800 (PST) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd-rwg@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w1FI9hi6058740; Thu, 15 Feb 2018 10:09:43 -0800 (PST) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <201802151809.w1FI9hi6058740@pdx.rh.CN85.dnsmgr.net> Subject: Re: How to remove a screwed up route? In-Reply-To: To: Lee Brown Date: Thu, 15 Feb 2018 10:09:43 -0800 (PST) CC: freebsd-net X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Feb 2018 18:09:49 -0000 > On Thu, Feb 15, 2018 at 9:47 AM, Scott Ellentuch wrote: > > > Hi, > > > > I did a very foolish thing.... > > > > route add -net 61.177.172.137 gw 127.0.0.1 > > > > > > 1) Thats not a net, thats a host > > 2) Thats my Linux's syntax, not what I expected > > > > So now I have the following in my netstat -rn > > > > 61.0.0.1&0x7f000001 MY.GW.IP.HERE UGSc 1 0 fxp0 > > > > > > And I don't know the right magic to delete it. > > > > Thanks, Tuc > > > > ... > What version of FreeBSD? That command did not work on my 11.1-RELEASE-p6 > system. I suspect the reason for it not working on your system is you do not have a host called gw, where as this person does. > > > root@apron:~ # route add -net 1.2.3.4 gw 127.0.0.1 > route: bad address: gw Try echo "1.2.3.4 gw" >>/etc/hosts and run the command again, you should now get an error about unreachable gateway. > Here's what worked for me. Just use route del with the same parameters I believe your correct, if the poster executes the orignal command with s/add/delete/ the right thing should just happen: route delete -net 61.177.172.137 gw 127.0.0.1 I believe if one looks at the man page for route: route [-n] command [-net | -host] destination gateway [netmask] [-fib number] you see that what happened here, after dns/hosts file translation was: route add -net 61.0.0.1 MY.GW.IP.HERE 127.0.0.1 The trailing 127.0.0.1 is interpretted as the netmask, and this is why you see 60.0.0.1&0x7f000001 as the route entry, 0x7f000001 is 127.0.0.1 in host order hex. > root@apron:~ # route add -net 1.2.3.4 127.0.0.1 > add net 1.2.3.4: gateway 127.0.0.1 > root@apron:~ # netstat -nr > Routing tables > > Internet: > Destination Gateway Flags Netif Expire > default 10.1.10.1 UGS bge0 > 1.2.3.4/32 127.0.0.1 UGS lo0 > 10.0.0.0/8 10.1.10.1 UGS bge0 > 10.1.10.0/24 link#1 U bge0 > 10.1.10.175 link#1 UHS lo0 > 127.0.0.1 link#2 UH lo0 > > Internet6: > Destination Gateway Flags > Netif Expire > ::/96 ::1 UGRS > lo0 > ::1 link#2 UH > lo0 > ::ffff:0.0.0.0/96 ::1 UGRS > lo0 > fe80::/10 ::1 UGRS > lo0 > fe80::%lo0/64 link#2 U > lo0 > fe80::1%lo0 link#2 UHS > lo0 > ff02::/16 ::1 UGRS > lo0 > > root@apron:~ # route del -net 1.2.3.4 127.0.0.1 > del net 1.2.3.4: gateway 127.0.0.1 > root@apron:~ # netstat -nr > Routing tables > > Internet: > Destination Gateway Flags Netif Expire > default 10.1.10.1 UGS bge0 > 10.0.0.0/8 10.1.10.1 UGS bge0 > 10.1.10.0/24 link#1 U bge0 > 10.1.10.175 link#1 UHS lo0 > 127.0.0.1 link#2 UH lo0 > > Internet6: > Destination Gateway Flags > Netif Expire > ::/96 ::1 UGRS > lo0 > ::1 link#2 UH > lo0 > ::ffff:0.0.0.0/96 ::1 UGRS > lo0 > fe80::/10 ::1 UGRS > lo0 > fe80::%lo0/64 link#2 U > lo0 > fe80::1%lo0 link#2 UHS > lo0 > ff02::/16 ::1 UGRS > lo0 > root@apron:~ # uname -a > FreeBSD apron.ad.nyingma.org 11.1-RELEASE-p6 FreeBSD 11.1-RELEASE-p6 #0 > r328506M: Sat Jan 27 23:09:57 PST 2018 > root@apron.ad.nyingma.org:/usr/obj/usr/src/sys/GENERIC > amd64 > _______________________________________________ > freebsd-net@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > > -- Rod Grimes rgrimes@freebsd.org