I want to set up a static IP address using /etc/network/interfaces
. How can I do that?
-
Is your setup a desktop ubuntu or a server ubuntu?– ptetteh227Nov 6, 2018 at 9:50
-
Which Ubuntu version do you use? What have you tried so far? Please edit your question to include the details.– MelebiusNov 6, 2018 at 12:49
-
4Possible duplicate of Set static IP Ubuntu– AlwaysTalkingAboutMyDogNov 7, 2018 at 1:43
1 Answer
I'm just gonna quote this great article:
Defining physical interfaces such as eth0
Lines beginning with the word “auto” are used to identify the physical interfaces to be brought up when ifup is run with the -a option. (This option is used by the system boot scripts.) Physical interface names should follow the word “auto” on the same line. There can be multiple “auto” stanzas. ifup brings the named inter faces up in the order listed. For example following example setup eth0 (first network interface card) with 192.168.1.5 IP address and gateway (router) to 192.168.1.254:
iface eth0 inet static
address 192.168.1.5
netmask 255.255.255.0
gateway 192.168.1.254
Setup interface to dhcp
To setup eth0 to dhcp, enter:
auto eth0
iface eth0 inet dhcp
If you're new to Ubuntu, or Linux in general, I recommend you bookmark that site. He has a lot of great articles and tutorials that will help you out.