Linux static IP network configuration¶
Configuring a static IP address on a Linux system typically involves editing network interface configuration files. These configurations assign a fixed IP address, netmask, gateway, and DNS settings to a specific device, such as ens33.^[600-developer__tools__vscode__vmware.md]
Configuration File¶
On many Linux distributions, network settings are managed via configuration scripts located in /etc/sysconfig/network-scripts/ (implied by the syntax). To set a static IP, the interface file (e.g., ifcfg-ens33) must be modified to include specific parameters.^[600-developer__tools__vscode__vmware.md]
Static IP Parameters¶
The following configuration defines a static IP setup.^[600-developer__tools__vscode__vmware.md]
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
IPV6_AUTOCONF=no
IPV6_DEFROUTE=no
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=deff87b2-8e32-4c73-971e-d38f6b258113
DEVICE=ens33
ONBOOT=yes
IPV6_PRIVACY=no
PREFIX=24
IPADDR=192.168.79.20
GATEWAY=192.168.79.1
NETMASK=255.255.255.0
DNS1=192.168.79.1
Key Directives¶
To switch from DHCP to a static configuration, the primary directive to change is BOOTPROTO, which should be set to static.^[600-developer__tools__vscode__vmware.md] Additionally, the ONBOOT parameter must be set to yes to ensure the interface activates automatically at boot.^[600-developer__tools__vscode__vmware.md]
The essential network definitions include:
- IPADDR: The desired static IP address (e.g.,
192.168.79.20).^[600-developer__tools__vscode__vmware.md] - NETMASK: The subnet mask (e.g.,
255.255.255.0).^[600-developer__tools__vscode__vmware.md] - GATEWAY: The default gateway IP address.^[600-developer__tools__vscode__vmware.md]
- PREFIX: The CIDR notation for the subnet mask (e.g.,
24).^[600-developer__tools__vscode__vmware.md] - DNS1: The primary DNS server address.^[600-developer__tools__vscode__vmware.md]
Related Concepts¶
- [[Virtualization]]
- [[Network Interface]]
Sources¶
^[600-developer__tools__vscode__vmware.md]