/etc/network/interfaces
head -5 /etc/network/interfaces
You can see:
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
This config file already has some setup:
# grep -v "^$\|^#" /etc/dhcpcd.conf
hostname
clientid
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
require dhcp_server_identifier
slaac private
nohook lookup-hostname
To configure static IP address add the folowing lines at the end of /etc/dhcpcd.conf
interface eth0
static ip_address=192.168.1.XX/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
All Subnet Mask codes
/30 255.255.255.252
/29 255.255.255.248
/28 255.255.255.240
/27 255.255.255.224
/26 255.255.255.192
/25 255.255.255.128
/24 255.255.255.0
/23 255.255.254.0
/22 255.255.252.0
/21 255.255.248.0
/20 255.255.240.0
/19 255.255.224.0
/18 255.255.192.0
/17 255.255.128.0
/16 255.255.0.0
After reboot you can see active gateway in:
route -n
DNS you can see in file:
cat /etc/resolv.conf
Related:https://www.aelius.com/njh/subnet_sheet.html
No comments:
Post a Comment