Hardware Reference
In-Depth Information
$ vi ifcfg-eth0
You'll see something like this:
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
NM_CONTROLLED=yes
You need to change the BOOTPROTO line from dhcp to static . Also make sure ONBOOT is
set to yes . Then add IPADDR , NETMASK , BROADCAST , and NETWORK information like you would
have in the headless file. Remember not to choose an IP address already in use else-
where in your network. NETMASK is always 255.255.255.0 . GATEWAY is your router's IP
address:
IPADDR=192.168.1.123
NETMASK=255.255.255.0
BROADCAST=192.168.1.255
GATEWAY=192.168.1.1
Finally, restart the network service to apply your new settings:
$ systemctl restart network.service
If you're using a Raspbian-based distro, you'll follow similar steps, just in a different
place. Rather than looking for separate files, open /etc/network/interfaces (as root):
$ su -c 'vi /etc/network/interfaces'
Then look for the line:
iface eth0 inet dhcp
Change dhcp to static , and add your static IP address, gateway, broadcast, and net-
mask:
iface eth0 inet static
address 192.168.1.123
gateway 192.168.1.1
broadcast 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
If you need a little help gathering these, you can find the current IP address, netmask,
and broadcast by running ifconfig and noting the inet addr , mask , and bcast , respec-
tively, while route -n will give you the gateway and network, which it calls Destina
tion . (Again, on newer Fedora and Pidora versions, use ip addr instead of ifconfig .)
Search WWH ::




Custom Search