Static IP address without removing DHCP

Douglas Stanley douglas.m.stanley at gmail.com
Sun Oct 26 12:41:06 UTC 2014


Don't forget to add the options:

dns-nameservers
dns-search

Otherwise you may not be able to resolve DNS.

Doug
On Oct 26, 2014 8:26 AM, "Dotan Cohen" <dotancohen at gmail.com> wrote:

> I need to ensure that a particular machine has a static IP address. Is
> this the right way to configure /etc/network/interfaces?
>
> auto eth0
>     iface eth0 inet static
>     address 10.0.0.7
>     netmask 255.255.255.0
>     gateway 10.0.0.138
>
> The current configuration, using DHCP looks like this:
> $ ifconfig
> eth0      Link encap:Ethernet  HWaddr 90:2b:34:a9:c5:ae
>           inet addr:10.0.0.7  Bcast:10.0.0.255  Mask:255.255.255.0
>           inet6 addr: fe80::922b:34ff:fea9:c5ae/64 Scope:Link
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:190131 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:142571 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000
>           RX bytes:130422046 (130.4 MB)  TX bytes:28887979 (28.8 MB)
>
> lo        Link encap:Local Loopback
>           inet addr:127.0.0.1  Mask:255.0.0.0
>           inet6 addr: ::1/128 Scope:Host
>           UP LOOPBACK RUNNING  MTU:65536  Metric:1
>           RX packets:13281 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:13281 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:0
>           RX bytes:1351192 (1.3 MB)  TX bytes:1351192 (1.3 MB)
>
> $ route -n
> Kernel IP routing table
> Destination     Gateway         Genmask         Flags Metric Ref    Use
> Iface
> 0.0.0.0         10.0.0.138      0.0.0.0         UG    0      0        0
> eth0
> 10.0.0.0        0.0.0.0         255.255.255.0   U     1      0        0
> eth0
>
>
> I'm asking here as I don't want to get into a situation where I can no
> longer communicate with the machine while testing different
> configurations. Thanks.
>
> I took the basic config skeleton from the Ubuntu server guide Network
> Configuration page:
> https://help.ubuntu.com/14.04/serverguide/network-configuration.html
>
> --
> Dotan Cohen
>
> http://gibberish.co.il
> http://what-is-what.com
>
> --
> ubuntu-server mailing list
> ubuntu-server at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
> More info: https://wiki.ubuntu.com/ServerTeam
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-server/attachments/20141026/148a6a74/attachment.html>


More information about the ubuntu-server mailing list