09.11.2012 Views

Mac OS X Server Command-Line Administration - Apple

Mac OS X Server Command-Line Administration - Apple

Mac OS X Server Command-Line Administration - Apple

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Viewing or Changing IP Address, Subnet Mask, or Router Address<br />

You can use the serversetup and networksetup commands to change a computer’s<br />

TCP/IP settings.<br />

Important: Changing a server’s IP address isn’t as simple as changing the TCP/IP<br />

settings. You must first run the changeip utility to make sure necessary changes are<br />

made throughout the system. See “Changing a <strong>Server</strong>’s IP Address” on page 39.<br />

To list TCP/IP settings for a configuration:<br />

$ sudo networksetup -getinfo "configuration"<br />

Example:<br />

$ networksetup -getinfo "Built-In Ethernet"<br />

Manual Configuration<br />

IP Address: 192.168.10.12<br />

Subnet mask: 255.255.0.0<br />

Router: 192.18.10.1<br />

Ethernet Address: 1a:2b:3c:4d:5e:6f<br />

To view TCP/IP settings for port en0:<br />

$ serversetup -getDefaultinfo (devicename|"portname")<br />

To view TCP/IP settings for a particular port or device:<br />

$ serversetup -getInfo (devicename|"portname")<br />

To change TCP/IP settings for a particular port or device:<br />

$ sudo serversetup -setInfo (devicename|"portname") ipaddress subnetmask<br />

router<br />

To set manual TCP/IP information for a configuration:<br />

$ sudo networksetup -setmanual "configuration" ipaddress subnetmask router<br />

To validate an IP address:<br />

$ serversetup -isValidIPAddress ipaddress<br />

Displays 0 if the address is valid, 1 if it isn’t.<br />

To validate a subnet mask:<br />

$ serversetup -isValidSubnetMask subnetmask<br />

To set a configuration to use DHCP:<br />

$ sudo networksetup -setdhcp "configuration" [clientID]<br />

To set a configuration to use DHCP with a manual IP address:<br />

$ sudo networksetup -setmanualwithdhcprouter "configuration" ipaddress<br />

To set a configuration to use BootP:<br />

$ sudo networksetup -setbootp "configuration"<br />

40 Chapter 5 Network Preferences

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!