Re: /etc/hosts - how does that file work?? - was weird nfs issues.
On Saturday 06 June 2009 20:44:38 Tim Judd wrote: > On 6/4/09, Peter wrote: > > I do not think /etc/hosts does round robin, I always assumed first match > > wins...DNS/bind I would understand... It's the same library call: gethostbyname(3) and friends. > > Why does ping always return the 172.20.6.1 address, > > and ftp,nc,ssh,telnet,fetch _always_ uses the 116 address? Again: client implementation is allowed to pick whichever it wants. > why are you so hung up on dual IPs for a single host? would dnsmasq > provide a solution to dual A records for one resource? Gotta agree with Tim here. I don't see the point for having two nets on one interface. They'll be hard to keep secure with firewall rules if you run the same services on them. > I'll help, when I can. but forcing this on /etc/hosts is a dead end. Problem is that nfs and DNS don't work well at all. For nfs best use IP or /etc/hosts. One drawback of using DNS with nfs is that if the hostname cannot be resolved (network down, typo), one can also not get a console when it goes to single user mode [1] and has to reboot via power button. /etc/fstab is supposed to be static to begin with. It's supposed to provide the mountpoints the system can count on, so using IP's for nfs is preferred. For the more dynamic nfs mounts, one can use hostnames and use noauto in the options column. [1] http://www.freebsd.org/cgi/query-pr.cgi?pr=128448 -- Mel ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: /etc/hosts - how does that file work?? - was weird nfs issues.
On 6/4/09, Peter wrote: >> On Thursday 04 June 2009 20:48:21 Peter wrote: >>> iH, >>> This all started with NFS not mounting at bootso, testing in VMs: >> >> >> >>> Why is ping using one IP, and ssh/mount_nfs/showmount using another IP > from /etc/hosts? >> >> Q: Where is described that name resolution for A or PTR records should > be >> returned in a fixed order and that a consumer should always use the > first >> one >> returned? >> A: Nowhere. Name servers are encouraged to do round-robin returns if not > specified otherwise. Applications may sort/pick at their own leisure. >> >> -- >> Mel > > I do not think /etc/hosts does round robin, I always assumed first match > wins...DNS/bind I would understand... > > Why does ping always return the 172.20.6.1 address, > and ftp,nc,ssh,telnet,fetch _always_ uses the 116 address? > > I would assume at least sometimes it would hit the 172 address with > anything besides ping - but it only ping hits the 172 address... > If so, I'd guess there would be consistency between ping lookups and > 'telnet/ssh/etc' lookups... > > Why if the 116.23.45.3 last octet is bumped up, everything _always_ > returns the 172 address? > > client# grep server /etc/hosts > 172.20.6.1 server.test server > 116.23.45.5 server.test server > client# telnet server > Trying 172.20.6.1... > telnet: connect to address 172.20.6.1: Connection refused > Trying 116.23.45.5... > > /etc/hosts - 'server' changed to > 116.23.45.3: > > client# telnet server > Trying 116.23.45.3... > telnet: connect to address 116.23.45.3: Operation timed out > Trying 172.20.6.1... > telnet: connect to address 172.20.6.1: Connection refused > telnet: Unable to connect to remote host > > if server has ip>116.23.45.3, it always uses the 172 address first... > > but ping always uses the 172... > even if third entry is added into /etc/hosts - nothing ever uses it as the > first/primary IP. > > Is there an algorithm based on IP/program being used and the returned IP? > I can't sit and watch this thread anymore. Something itchin' to say: DNS, who can handle multiple A records in an optional round-robin design, is perfectly fine to assign multiple A records to a resource. /etc/hosts, which as always existed (back when the Internet was created/new), was a unique record source only. Having oddities in /etc/hosts is expected IMHO when a "mistake" like multiple resources assigned different records. What's to stop you from creating slightly different records in /etc/hosts? Whats to stop you from hitting 'privserver' and 'pubserver', for private and public IPs respectively. why are you so hung up on dual IPs for a single host? would dnsmasq provide a solution to dual A records for one resource? I'll help, when I can. but forcing this on /etc/hosts is a dead end. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: /etc/hosts - how does that file work?? - was weird nfs issues.
> On Thursday 04 June 2009 20:48:21 Peter wrote: >> iH, >> This all started with NFS not mounting at bootso, testing in VMs: > > > >> Why is ping using one IP, and ssh/mount_nfs/showmount using another IP from /etc/hosts? > > Q: Where is described that name resolution for A or PTR records should be > returned in a fixed order and that a consumer should always use the first > one > returned? > A: Nowhere. Name servers are encouraged to do round-robin returns if not specified otherwise. Applications may sort/pick at their own leisure. > > -- > Mel I do not think /etc/hosts does round robin, I always assumed first match wins...DNS/bind I would understand... Why does ping always return the 172.20.6.1 address, and ftp,nc,ssh,telnet,fetch _always_ uses the 116 address? I would assume at least sometimes it would hit the 172 address with anything besides ping - but it only ping hits the 172 address... If so, I'd guess there would be consistency between ping lookups and 'telnet/ssh/etc' lookups... Why if the 116.23.45.3 last octet is bumped up, everything _always_ returns the 172 address? client# grep server /etc/hosts 172.20.6.1 server.test server 116.23.45.5 server.test server client# telnet server Trying 172.20.6.1... telnet: connect to address 172.20.6.1: Connection refused Trying 116.23.45.5... /etc/hosts - 'server' changed to 116.23.45.3: client# telnet server Trying 116.23.45.3... telnet: connect to address 116.23.45.3: Operation timed out Trying 172.20.6.1... telnet: connect to address 172.20.6.1: Connection refused telnet: Unable to connect to remote host if server has ip>116.23.45.3, it always uses the 172 address first... but ping always uses the 172... even if third entry is added into /etc/hosts - nothing ever uses it as the first/primary IP. Is there an algorithm based on IP/program being used and the returned IP? ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: /etc/hosts - how does that file work?? - was weird nfs issues.
On Thursday 04 June 2009 20:48:21 Peter wrote: > iH, > This all started with NFS not mounting at bootso, testing in VMs: > Why is ping using one IP, and ssh/mount_nfs/showmount using another IP > from /etc/hosts? Q: Where is described that name resolution for A or PTR records should be returned in a fixed order and that a consumer should always use the first one returned? A: Nowhere. Name servers are encouraged to do round-robin returns if not specified otherwise. Applications may sort/pick at their own leisure. -- Mel ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
/etc/hosts - how does that file work?? - was weird nfs issues.
iH, This all started with NFS not mounting at bootso, testing in VMs: This is a fresh/generic install of 7.2-REL no firewall em1=10.21.20.0/24 network - DHCP for ssh access client# uname -a FreeBSD client.test 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Fri May 1 08:49:13 UTC 2009 r...@walker.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 client# cat /etc/rc.conf gateway_enable="YES" hostname="client.test" ifconfig_em0="inet 172.20.6.2 netmask 255.255.255.0" ifconfig_em0_alias0="inet 116.23.45.2 netmask 255.255.255.0" ifconfig_em1="DHCP" nfs_client_enable="YES" nfs_server_enable="NO" rpcbind_enable="NO" sshd_enable="YES" client# ifconfig em0|grep inet inet 172.20.6.2 netmask 0xff00 broadcast 172.20.6.255 inet 116.23.45.2 netmask 0xff00 broadcast 116.23.45.255 client# cat /etc/hosts ::1 localhost localhost.test 127.0.0.1 localhost localhost.test 172.20.6.2 client.test client 116.23.45.2 client.test client 172.20.6.1 server.test server 116.23.45.3 server.test server client# ping -c1 server PING server.test (172.20.6.1): 56 data bytes 64 bytes from 172.20.6.1: icmp_seq=0 ttl=64 time=5.811 ms --- server.test ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 5.811/5.811/5.811/0.000 ms client# ssh -vvv server OpenSSH_5.1p1 FreeBSD-20080901, OpenSSL 0.9.8e 23 Feb 2007 debug1: Reading configuration data /etc/ssh/ssh_config debug2: ssh_connect: needpriv 0 debug1: Connecting to server.test [116.23.45.3] port 22. ^C client# ssh to 'server' always goes to 116.23.45.3 IP there is nothing on '116.23.45.3' IP '116.23.45.3/24' is a made up network for testing BUT... client# ifconfig em0|grep inet inet 172.20.6.2 netmask 0xff00 broadcast 172.20.6.255 inet 116.23.45.2 netmask 0xff00 broadcast 116.23.45.255 client# cat /etc/hosts ::1 localhost localhost.test 127.0.0.1 localhost localhost.test 172.20.6.2 client.test client 116.23.45.2 client.test client 172.20.6.1 server.test server 116.23.45.4 server.test server client# ping -c1 server PING server.test (172.20.6.1): 56 data bytes 64 bytes from 172.20.6.1: icmp_seq=0 ttl=64 time=0.285 ms --- server.test ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 0.285/0.285/0.285/0.000 ms client# ssh -vvv server OpenSSH_5.1p1 FreeBSD-20080901, OpenSSL 0.9.8e 23 Feb 2007 debug1: Reading configuration data /etc/ssh/ssh_config debug2: ssh_connect: needpriv 0 debug1: Connecting to server.test [172.20.6.1] port 22. debug1: Connection established. ... .. Why if the secondary entry is higher than '116.23.45.3' it always goes to 172/24 network? Why is ping using one IP, and ssh/mount_nfs/showmount using another IP from /etc/hosts? ]confused[ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"