{"id":309,"date":"2014-04-23T18:30:31","date_gmt":"2014-04-23T22:30:31","guid":{"rendered":"http:\/\/blogs.tulsalabs.com\/?p=309"},"modified":"2025-11-12T02:24:49","modified_gmt":"2025-11-12T06:24:49","slug":"getting-static-addresses-in-a-linux-client-under-nat-and-vmware-fusion","status":"publish","type":"post","link":"http:\/\/blogs.tulsalabs.com\/?p=309","title":{"rendered":"Getting static addresses in a Linux client under NAT and VMware Fusion"},"content":{"rendered":"<p>I had a client working fine enough with DHCP, but I really want to be able to<br \/>\nconsistently ssh into it.<\/p>\n<p>I looked at:<\/p>\n<pre>\/Library\/Preferences\/VMware Fusion\/vmnet8\/dhcpd.conf\r\n<\/pre>\n<p>and determined that I did not have to modify it to get a static address:<\/p>\n<pre>allow unknown-clients;\r\ndefault-lease-time 1800;                # default is 30 minutes\r\nmax-lease-time 7200;                    # default is 2 hours\r\n\r\nsubnet 172.16.249.0 netmask 255.255.255.0 {\r\n        range 172.16.249.128 172.16.249.254;\r\n        option broadcast-address 172.16.249.255;\r\n        option domain-name-servers 172.16.249.2;\r\n        option domain-name localdomain;\r\n        default-lease-time 1800;                # default is 30 minutes\r\n        max-lease-time 7200;                    # default is 2 hours\r\n        option netbios-name-servers 172.16.249.2;\r\n        option routers 172.16.249.2;\r\n}\r\nhost vmnet8 {\r\n        hardware ethernet 00:50:56:C0:00:08;\r\n        fixed-address 172.16.249.1;\r\n        option domain-name-servers 0.0.0.0;\r\n        option domain-name \"\";\r\n        option routers 0.0.0.0;\r\n}\r\n<\/pre>\n<p>I.e., I could use addresses 172.16.249.2 -&gt; 172.16.249.127 for static assignment. (There is a bug in that statement, which is why I am writing this down.)<\/p>\n<p>I always skip the first 20 addresses, so I assigned:<\/p>\n<pre>KinSlayer:flexfiles loghyr$ more \/private\/etc\/hosts\r\n##\r\n# Host Database\r\n#\r\n# localhost is used to configure the loopback interface\r\n# when the system is booting.  Do not change this entry.\r\n##\r\n127.0.0.1       localhost\r\n255.255.255.255 broadcasthost\r\n::1             localhost \r\nfe80::1%lo0     localhost\r\n172.16.249.1    kinslayer\r\n172.16.249.21   skull\r\n172.16.249.22   kitty\r\n<\/pre>\n<p>skull to be 172.16.249.21.<\/p>\n<p>I modified skull&#8217;s \/etc\/sysconfig\/network:<\/p>\n<pre>[root@skull linux]# more \/etc\/sysconfig\/network\r\n# Created by anaconda\r\nHOSTNAME=skull\r\n<\/pre>\n<p>and \/etc\/sysconfig\/network-scripts\/ifcfg-eno16777736<\/p>\n<pre>[root@skull linux]# more \/etc\/sysconfig\/network-scripts\/ifcfg-eno16777736\r\nTYPE=\"Ethernet\"\r\nBOOTPROTO=\"static\"\r\nDEFROUTE=\"yes\"\r\nIPV4_FAILURE_FATAL=\"no\"\r\nIPV6INIT=\"yes\"\r\nIPV6_AUTOCONF=\"yes\"\r\nIPV6_DEFROUTE=\"yes\"\r\nIPV6_PEERDNS=\"yes\"\r\nIPV6_PEERROUTES=\"yes\"\r\nIPV6_FAILURE_FATAL=\"no\"\r\nNAME=\"eno16777736\"\r\nUUID=\"3e93f225-d48a-4de0-919a-5ef5d1f428e7\"\r\nONBOOT=\"yes\"\r\nHWADDR=\"00:0C:29:98:83:E7\"\r\nPEERDNS=\"yes\"\r\nPEERROUTES=\"yes\"\r\nDEVICE=eno16777736\r\nNM_CONTROLLED=no\r\nIPADDR=172.16.249.21\r\nNETMASK=255.255.255.0\r\nGATEWAY=172.16.249.1\r\nDNS1=172.16.249.1\r\n<\/pre>\n<p>Disabled Network Mangler and turned on network:<\/p>\n<pre>service NetworkManager stop\r\nchkconfig NetworkManager off\r\nyum erase NetworkManager\r\nservice network start\r\nchkconfig network on\r\n<\/pre>\n<p>I tested that I could ssh into and out of skull to my laptop. Fine, job done.<\/p>\n<p>Only DNS wasn&#8217;t working the next day:<\/p>\n<pre>[root@skull linux]# more \/etc\/resolv.conf\r\n# Generated by NetworkManager\r\ndomain localdomain\r\nsearch localdomain\r\nnameserver 172.16.249.1\r\n<\/pre>\n<p>I checked online, and found I should be using 172.16.249.2. Fine, job done.<\/p>\n<p>Well then I couldn&#8217;t get to github.com port 22 to get a project update.<\/p>\n<p>Push comes to shove, I should have not assumed that 172.16.249.1 is special<br \/>\nwith this NAT. It is not the laptop as far as a DNS server and gateway is concerned.<\/p>\n<p>So I changed this line in \/etc\/sysconfig\/network-scripts\/ifcfg-eno16777736:<\/p>\n<pre>GATEWAY=172.16.249.2\r\n<\/pre>\n<p>And restarted the network &#8211; now my DNS change was gone (why does service network restart add in the line about &#8220;# Generated by NetworkManager&#8221; to \/etc\/resolv.conf ??).<\/p>\n<p>Fine, fixed this line as well:<\/p>\n<pre>DNS1=172.16.249.2\r\n<\/pre>\n<p>And restarted.<\/p>\n<p>Now it all works, I think. \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had a client working fine enough with DHCP, but I really want to be able to consistently ssh into it. I looked at: \/Library\/Preferences\/VMware Fusion\/vmnet8\/dhcpd.conf&#46;&#46;&#46;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,23],"tags":[],"class_list":["post-309","post","type-post","status-publish","format-standard","hentry","category-macs","category-vm"],"_links":{"self":[{"href":"http:\/\/blogs.tulsalabs.com\/index.php?rest_route=\/wp\/v2\/posts\/309","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blogs.tulsalabs.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blogs.tulsalabs.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blogs.tulsalabs.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blogs.tulsalabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=309"}],"version-history":[{"count":1,"href":"http:\/\/blogs.tulsalabs.com\/index.php?rest_route=\/wp\/v2\/posts\/309\/revisions"}],"predecessor-version":[{"id":310,"href":"http:\/\/blogs.tulsalabs.com\/index.php?rest_route=\/wp\/v2\/posts\/309\/revisions\/310"}],"wp:attachment":[{"href":"http:\/\/blogs.tulsalabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=309"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blogs.tulsalabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=309"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blogs.tulsalabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}