Static IP on Ethernet

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
mperkel

Static IP on Ethernet

Post by mperkel »

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.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
kukamuumuka

Re: Static IP on Ethernet

Post by kukamuumuka »

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

Re: Static IP on Ethernet

Post by mperkel »

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.
kukamuumuka

Re: Static IP on Ethernet

Post by kukamuumuka »

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

Re: Static IP on Ethernet

Post by mperkel »

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.
Locked

Return to “Networking”