King Zone - Fedora
type: channel
link: https://kingtam.win/tag/Fedora/
items: Setting a Static IP address in Linux

Setting a Static IP address in Linux
type: item
date: 2022-03-18T13:00:00+08:00
description: Setting a Static IP address in LinuxSetting a static IP address in Linux.pngIntroduction: Usually, IP addresses are dynamically assigned by the router's DHCP server on most network devices. But using a static IP address on the server makes the provided services more stable. If the DHCP server is not working, it will affect the computers in the local area network to obtain IP addresses, thereby affecting access to services, while servers with static IP addresses are not affected, so static IP is also necessary (on devices providing services).Table of Contents: Configuring a static IP address in RHEL/CentOS/Fedora:Setting a static IP address in Debian / Ubuntu (versions prior to 17.10):Setting a static IP address in Ubuntu (newer versions):Setting up VLAN in Ubuntu:Setting up Bridge in Debian:Bridge without VLANBridge with VLANConfiguring a static IP address in RHEL/CentOS/Fedora: To set a static IP address in RHEL / CentOS / FedoraFirst check the local network interface name:2022-03-18_121212.pngThe above figure shows that the network interface name of the local machine is eth0, representing the edited network file ifcfg-eth0Use nano or vim to edit:vim /etc/sysconfig/network-scripts/ifcfg-eth0Make changes to the ifcfg-eth0 file based on your own network:DEVICE="eth0" BOOTPROTO="static" DNS1="8.8.8.8" DNS2="1.1.1.1" GATEWAY="192.168.0.1" HOSTNAME="linux.kingtam.win" HWADDR="00:19:99:A4:46:AB" IPADDR="192.68.0.100" NETMASK="255.255.255.0" NM_CONTROLLED="yes" ONBOOT="yes" TYPE="Ethernet" UUID="8105c095-799b-4f5a-a445-c6d7c3681f07"You need to edit the following settings:BOOTPROTO is dhcp (default) or static (static)DNS1 and DNS2 can use public DNS services such as 8.8.8.8, 1.1.1.1Gateway (GATEWAY) is the IP of the router or firewallHost name (HOSTNAME) customizableNetwork mask (NETMASK) is usually 255.255.255.0 (/24) modify according to your own network parametersIP address (IPADDR) the local IP addressONBOOT whether to start automatically is yes or noThen edit: resolve.…