Ubuntu Server Static IP |
Sometimes the things that seem the most obvious are the most difficult to get to work. If you plug in the values for your local network, you should be able to cut and paste. Assumptions
In order configure your Ubuntu server for a static external IP address, you will have to change '/etc/network/interfaces'. So lets back it up: cp /etc/network/interfaces{,.`date +%F`.BU}
Now open '/etc/network/interfaces' and add the following: # The primary network interface
auto eth0
iface eth0 inet static
address 96.50.96.232
netmask 255.255.252.0
broadcast 96.50.99.255
network 96.50.96.0
gateway 96.50.96.1
Don't forget to comment out: # The primary network interface auto eth0 iface eth0 inet dhcp In the end your file should look something like: # This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
#auto eth0
#iface eth0 inet dhcp
# The primary network interface
auto eth0
iface eth0 inet static
address 96.50.96.232
netmask 255.255.252.0
broadcast 96.50.99.255
network 96.50.96.0
gateway 96.50.96.1
At this point you could restart your network, and it would likely work... But, lets look at 'dhclient.conf' which, depending on your distro may be in '/etc/dhcp' or '/etc/dhcp3'
# Configuration file for /sbin/dhclient, which is included in Debian's
# dhcp3-client package.
#
# This is a sample configuration file for dhclient. See dhclient.conf's
# man page for more information about the syntax of this file
# and a more comprehensive list of the parameters understood by
# dhclient.
#
# Normally, if the DHCP server provides reasonable information and does
# not leave anything out (like the domain name, for example), then
# few changes must be made to this file, if any.
#
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name "<hostname>";
#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
#send dhcp-lease-time 3600;
#supersede domain-name "fugue.com home.vix.com";
#prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers;
#require subnet-mask, domain-name-servers;
#timeout 60;
#retry 60;
#reboot 10;
#select-timeout 5;
#initial-interval 2;
#script "/etc/dhcp3/dhclient-script";
#media "-link0 -link1 -link2", "link0 link1";
#reject 192.33.137.209;
#alias {
# interface "eth0";
# fixed-address 192.5.5.213;
# option subnet-mask 255.255.255.255;
#}
#lease {
# interface "eth0";
# fixed-address 192.33.137.200;
# medium "link0 link1";
# option host-name "andare.swiftmedia.com";
# option subnet-mask 255.255.255.0;
# option broadcast-address 192.33.137.255;
# option routers 192.33.137.250;
# option domain-name-servers 127.0.0.1;
# renew 2 2000/1/12 00:00:01;
# rebind 2 2000/1/12 00:00:01;
# expire 2 2000/1/12 00:00:01;
#}
All of the parameters following the 'request' statement: request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers;
will no longer be supplied by the dhcp server and will either have to be set in some other way or in some cases ignored. The file that you should look at is '/etc/resolv.conf' it's where your the the values for 'domain-name', 'domain-name-servers' and 'domain-search', like so: nameserver 8.8.8.8 domain example.com search example.com The parameters 'subnet-mask', 'broadcast-address' and 'routers' have been set already. 'time-offset', 'netbios-name-servers', 'netbios-scope', 'rfc3442-classless-static-routes' and 'ntp-servers' can be ignored (or set. I'm leaving that up to you to figure out.) If you would like to set 'interface-mtu', it can be done in the '/etc/network/interfaces' file like so: # The primary network interface
auto eth0
iface eth0 inet static
address 96.50.96.232
netmask 255.255.252.0
broadcast 96.50.99.255
network 96.50.96.0
gateway 96.50.96.1
mtu 1500
Note the addition of the 'mtu 1500' line at the end..." That should about do it.. |



