Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4906

Networking and servers • Re: How do I set a static ip via config file?

$
0
0

Code:

allow-hotplug eth0    iface eth0 inet static    address 192.168.1.XXX/24       netmask 255.255.255.0    gateway 192.168.1.1
So you're living back about 12 years ago.
The modern way is with NetworkManager (if you must do it that way) or by programming your internet router (DHCP server) to always hand out the same address to the same MAC address.

Using a command like
nmcli con mod "Wired connection 1" \
ipv4.addresses "192.168.xxx.yyy/24" \
ipv4.gateway "192.168.xxx.zzz" \
ipv4.dns "8.8.8.8/8.8.4.4" \
ipv4.method "manual"
(With suitable addresses.)

Is a better, more modern, supported method of setting IP addresses using network manager.

Statistics: Posted by DougieLawson — Wed Dec 04, 2024 2:31 pm



Viewing all articles
Browse latest Browse all 4906

Trending Articles