Static IP In Linux

 Configure a static IP address on CentOS 7 / RHEL 7

URL :- How to configure a static IP address on CentOS 7 / RHEL 7

Path :- cat /etc/sysconfig/network-scripts/ifcfg-enp0s3

                 BOOTPROTO=static

                       IPADDR=192.168.1.150

                       NETMASK=255.255.255.0

                       GATEWAY=192.168.1.1

                        DNS=8.8.8.8

Path :-   cat /etc/resolv.conf

                    # Generated by NetworkManager

                                     nameserver 9.9.9.9

Command :- systemctl restart network

How to Restart Network Service on CentOS 8 or RHEL 8

Method 1 – Using nmcli Tool

Use the followings commands to start/stop network service on your CentOS/RHEL 8 Linux system.

sudo systemctl start NetworkManager.service
sudo systemctl stop NetworkManager.service

Use the followings commands to restart network service on your CentOS/RHEL 8 Linux system.

sudo systemctl restart NetworkManager.service

sudo nmcli networking off

sudo nmcli networking on



            Method 1 - Using nmtui

Static IP in Ubuntu:-

  URL :- https://www.freecodecamp.org/news/setting-a-static-ip-in-ubuntu-linux-ip-address-tutorial/

Step 1: Launch the terminal

You can launch the terminal using the shortcut Ctrl+ Shift+t.

Step 2: Note information about the current network

# ip a

Note the subnet :- ifconfig -a

Step 3: Make configuration changes

Netplan is the default network management tool for the latest Ubuntu versions. Configuration files for Netplan are written using YAML and end with the extension .yaml.

Go to the netplan directory located at /etc/netplan.

I'll create a file named 01-network-manager-all.yaml.

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: false
      dhcp6: false
     addresses:
      - 192.168.10.10/24
     routes:
      - to: default
        via: 192.168.10.1
     nameservers:
       addresses: [192.168.10.1]

Step 4: Apply and test the changes

# sudo netplan try


Comments

Popular posts from this blog

Bash Script