Static IP on Ethernet

Questions about cabled networking
Forum rules
Before you post please read how to get help
mperkel
Level 1
Level 1
Posts: 26
Joined: Tue Sep 02, 2014 6:39 pm

Static IP on Ethernet

Postby mperkel » Fri Oct 20, 2017 11:30 am

I would like to set static IP address on my Ethernet. I tried the nm-connection-editor program and it's too broken to use. I should report the bugs, but for now - what files can I edit manually to get a static IP address?

Also - where do I report bugs?

Thanks in advance.

User avatar
administrollaattori
Level 12
Level 12
Posts: 4284
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Re: Static IP on Ethernet

Postby administrollaattori » Fri Oct 20, 2017 12:01 pm

https://wiki.debian.org/NetworkConfiguration

If you're configuring it manually then something like this will set the default gateway (network, broadcast and gateway are optional):


auto eth0
iface eth0 inet static
address 192.0.2.7
netmask 255.255.255.0
gateway 192.0.2.254

mperkel
Level 1
Level 1
Posts: 26
Joined: Tue Sep 02, 2014 6:39 pm

Re: Static IP on Ethernet

Postby mperkel » Fri Oct 20, 2017 2:00 pm

I tried this:

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.2.240
netmask 255.255.255.0
gateway 192.168.2.1
dns-nameservers 127.0.0.1

But it has no effect. It still does DHCP.

enp2s0 Link encap:Ethernet HWaddr 40:16:7e:e8:b7:88
inet addr:192.168.2.127 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::23e2:2f9e:67c3:606c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7599 errors:0 dropped:0 overruns:0 frame:0
TX packets:6163 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4993853 (4.9 MB) TX bytes:855455 (855.4 KB)

Thanks for your help.

User avatar
administrollaattori
Level 12
Level 12
Posts: 4284
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Re: Static IP on Ethernet

Postby administrollaattori » Fri Oct 20, 2017 2:19 pm

mperkel wrote:enp2s0 Link encap:Ethernet HWaddr 40:16:7e:e8:b7:88
.

Your interface is enp2s0, so replace eth0 with enp2s0

Command ifconfig tells interfaces.

mperkel
Level 1
Level 1
Posts: 26
Joined: Tue Sep 02, 2014 6:39 pm

Re: Static IP on Ethernet

Postby mperkel » Fri Oct 20, 2017 2:33 pm

administrollaattori wrote:
mperkel wrote:enp2s0 Link encap:Ethernet HWaddr 40:16:7e:e8:b7:88
.

Your interface is enp2s0, so replace eth0 with enp2s0

Command ifconfig tells interfaces.


Thanks - that worked! Really appreciate that.


Return to “Ethernet”

Who is online

Users browsing this forum: No registered users and 4 guests