Archive for the ‘Macs’ Category

Getting static addresses in a Linux client under NAT and VMware Fusion

Wednesday, April 23rd, 2014

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

and determined that I did not have to modify it to get a static address:

allow unknown-clients;
default-lease-time 1800;                # default is 30 minutes
max-lease-time 7200;                    # default is 2 hours

subnet 172.16.249.0 netmask 255.255.255.0 {
        range 172.16.249.128 172.16.249.254;
        option broadcast-address 172.16.249.255;
        option domain-name-servers 172.16.249.2;
        option domain-name localdomain;
        default-lease-time 1800;                # default is 30 minutes
        max-lease-time 7200;                    # default is 2 hours
        option netbios-name-servers 172.16.249.2;
        option routers 172.16.249.2;
}
host vmnet8 {
        hardware ethernet 00:50:56:C0:00:08;
        fixed-address 172.16.249.1;
        option domain-name-servers 0.0.0.0;
        option domain-name "";
        option routers 0.0.0.0;
}

I.e., I could use addresses 172.16.249.2 -> 172.16.249.127 for static assignment. (There is a bug in that statement, which is why I am writing this down.)

I always skip the first 20 addresses, so I assigned:

KinSlayer:flexfiles loghyr$ more /private/etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0     localhost
172.16.249.1    kinslayer
172.16.249.21   skull
172.16.249.22   kitty

skull to be 172.16.249.21.

I modified skull’s /etc/sysconfig/network:

[root@skull linux]# more /etc/sysconfig/network
# Created by anaconda
HOSTNAME=skull

and /etc/sysconfig/network-scripts/ifcfg-eno16777736

[root@skull linux]# more /etc/sysconfig/network-scripts/ifcfg-eno16777736
TYPE="Ethernet"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME="eno16777736"
UUID="3e93f225-d48a-4de0-919a-5ef5d1f428e7"
ONBOOT="yes"
HWADDR="00:0C:29:98:83:E7"
PEERDNS="yes"
PEERROUTES="yes"
DEVICE=eno16777736
NM_CONTROLLED=no
IPADDR=172.16.249.21
NETMASK=255.255.255.0
GATEWAY=172.16.249.1
DNS1=172.16.249.1

Disabled Network Mangler and turned on network:

service NetworkManager stop
chkconfig NetworkManager off
yum erase NetworkManager
service network start
chkconfig network on

I tested that I could ssh into and out of skull to my laptop. Fine, job done.

Only DNS wasn’t working the next day:

[root@skull linux]# more /etc/resolv.conf
# Generated by NetworkManager
domain localdomain
search localdomain
nameserver 172.16.249.1

I checked online, and found I should be using 172.16.249.2. Fine, job done.

Well then I couldn’t get to github.com port 22 to get a project update.

Push comes to shove, I should have not assumed that 172.16.249.1 is special
with this NAT. It is not the laptop as far as a DNS server and gateway is concerned.

So I changed this line in /etc/sysconfig/network-scripts/ifcfg-eno16777736:

GATEWAY=172.16.249.2

And restarted the network – now my DNS change was gone (why does service network restart add in the line about “# Generated by NetworkManager” to /etc/resolv.conf ??).

Fine, fixed this line as well:

DNS1=172.16.249.2

And restarted.

Now it all works, I think. :-)

Getting mail clients to work with domains at Gmail

Monday, April 21st, 2014

My work email is Thomas.Haynes@example.org and is actually maintained at gmail.com.

Both Mail.app and mutt have had a hard time configuring for it.

For Mail.app:

  1. Set it up as normal for a Google IMAP account.
  2. Then go to Mail -> Preferences, select the account.
  3. Then on the “Outgoing Mail Server (SMTP):”, select by left click the server
  4. and then “Edit SMTP Server List …”.
  5. Now, select the server again
  6. First you’ll want to change the “Description” to be “Example.org” (this is in the “Account Information”)
  7. Second you will want to select Advanced
  8. Third, change the “User Name:” from “First.Last@gmail.com” to be “First.Last@example.org”

It should work now

For mutt, I followed the directions at Consolify your Gmail with MUTT with the exception of the following line:

set smtp_url = "smtp://yourusername@smtp.gmail.com:587/"

I modified it to be:

set smtp_url = "smtp://First.Last@example.org@smtp.gmail.com:587/"

 

Enable the postfix Mail Transfer Agent

Monday, May 7th, 2012

I want to use git’s mailing capabilities on OS X Lion to send out patches. How do I configure the MTA?

This Enable the postfix Mail Transfer Agent looks interesting, but old:

  loghyr:postfix root# head /etc/hostconfig 
  # This file is going away

But I think we can control all of this from the postfix(1).

  loghyr:postfix root# postconf -d | grep etc
  alias_database = hash:/etc/aliases
  alias_maps = hash:/etc/aliases
  config_directory = /etc/postfix
  sample_directory = /etc/postfix

I’m going to need a version for my home network and my vpn network:

loghyr:postfix root# cp main.cf home.cf
loghyr:postfix root# cp main.cf work.cf
loghyr:postfix root# cp main.cf default.cf

Edit the config files and start it:

loghyr:postfix root# cp work.cf main.cf
loghyr:postfix root# postfix start 
postfix/postfix-script: warning: group or other writable: /Library/Server/Mail/Data/mta
postfix/postfix-script: starting the Postfix mail system

How do I get it to stay launched? What’s the correctly way to make Postfix run permanently on Lion (not server)

I can switch my config files as needed.

Hmm, it works. I can’t show you, but it works.

The main thing I changed from the article I linked in was the relayhost:

relayhost = [mail.internal.excfb.com]

My setup assumes that I am connecting to an already working mail server in the domain. I.e., my iMac isn’t going to be receiving mail, just sending it.

Make Safari remember a password

Monday, January 23rd, 2012

http://www.switchingtomac.com/tutorials/safari/how-to-make-safari-remember-passwords/

VMware Fusion 4.0 networking

Monday, December 19th, 2011

Hint: Look down in /Library/Preferences/VMware\ Fusion

Netgear WN3000RP and iPhone

Saturday, August 13th, 2011

Just had a weird experience with my Netgear “Universal WiFi Range Extender WN3000RP”.

It seemed pretty evident I wouldn’t be able to automatically add it to my Airport network, so I whipped out my iPhone and quickly connected to the NETGEAR_EXT network. And I quickly got it connected to my home network. I even told it to use the same password as my home network.

And just as quickly, it was not useable. I could not connect the iPhone to the new network and when I got out an old laptop, it wasn’t working either.

So, I got out my trusty paper clip and reset the Netgear box. And this time, as I was installing, I paid more attention. The issue turned out to be a nasty interaction between the iPhone browser automatically making the first character in the data entry be upper case and the Nethgear being case sensitive for the password. I don’t know that I’ve ever encountered the case sensitivity, but maybe I’m just super cautious with that normally.

I also can’t figure out why with an unobstructed view of my Airport Extreme Base Station I’m loosing 31% connectivity and through one wall, I’m seeing 48% loss.

VMware upgrade might blow away your networking

Monday, June 27th, 2011

If you have customized your Fusion networking, be sure to make a copy of /Library/Application\ Support/VMware\ Fusion/networking to your home directory before upgrading.

And then copy it back and before you start up a VM, do sudo ./boot.sh –start in that directory.

bash: git-upload-pack: command not found

Friday, March 18th, 2011

git clone via ssh on Mac OS X

Don’t whine about wget on OS X

Friday, March 11th, 2011

OS X: Using curl instead of wget

Or:

loghyr:xdr thomas$ wget http://www.ietf.org/rfc/rfc1094.txt
-bash: wget: command not found
loghyr:xdr thomas$ curl -L http://www.ietf.org/rfc/rfc1094.txt > nfsv2.x
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49940  100 49940    0     0  97348      0 --:--:-- --:--:-- --:--:--  140k

OS X will create sparse files across NFS, or does it?

Monday, February 14th, 2011
KinMage:src thomas$ sudo mount -o vers=3,intr 172.16.1.129:/fooper /mnt
KinMage:src thomas$ ls -la /mnt
total 8
drwxrwxrwx   2 root  wheel  4096 Feb 13 21:50 .
drwxrwxr-t  24 root  admin  1224 Feb 13 21:54 ..

Where 172.16.1.129 is snakey, the Linux VM I am using for testing.

And then:

KinMage:mnt thomas$ python punch.py 
KinMage:mnt thomas$ ls -la p*out
-rw-r--r--  1 thomas  staff    1023 Feb 13 21:54 p1023.out
-rw-r--r--  1 thomas  staff    1024 Feb 13 21:54 p1024.out
-rw-r--r--  1 thomas  staff    1025 Feb 13 21:54 p1025.out
-rw-r--r--  1 thomas  staff   10250 Feb 13 21:54 p10250.out
-rw-r--r--  1 thomas  staff  102500 Feb 13 21:54 p102500.out
-rw-r--r--  1 thomas  staff      64 Feb 13 21:54 p64.out
KinMage:mnt thomas$ du -sh p*out
1.0K	p1023.out
1.0K	p1024.out
1.5K	p1025.out
 10K	p10250.out
100K	p102500.out
512B	p64.out

So it creates sparse files across NFS!

Well, yes and no. It will only send a block of data across and then the
server OS decides to create the sparse file or not.

Another thing to note is that the size reported is flexible in the sense
that the underlying file system interface determines how much space
is being reported:

[thomas@snakey fooper]$ du -sh p*out
4.0K	p1023.out
4.0K	p1024.out
4.0K	p102500.out
4.0K	p10250.out
4.0K	p1025.out
4.0K	p64.out

Ideally we would like the sizes to match, but since we are pulling a fast one, we get what we see.