Settings of static ip in linux

The purpose of setting static IP in Linux is so that when we learn Hadoop later, the IP will not keep changing and is only for learning use.

1. Use finalshell to connect to the virtual machine

        1.1. First use the ip addr command in the vm to check the ip

         1.2. Create a new Linux connection window in finalshell and enter the host name, IP address, user name and password.

        If successful, a pop-up window will appear, just select Save and Continue.

       

2. Modify and modify the static network card

1. Set up a static IP

vi /etc/sysconfig/network-scripts/ifcfg-ens33

How to check the gateway of your virtual machine:

Complete configuration (don’t copy mine): 114 China Telecom 8 is Google

TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="60738953-c9fc-420e-b1e1-d727d0987e90"
DEVICE="ens33"
ONBOOT="yes"

IPADDR="192.168.89.128"
NETMASK="255.255.255.0"
GATEWAY="192.168.89.2"
DNS1="114.114.114.114"
DNS2="8.8.8.8"

Remember to restart the network card service:

systemctl restart network

3. Set the username of the linux server

hostname View current username
 
1. Temporary modification
hostname bigdata01 temporarily sets the username, and it goes back as soon as it restarts.

2. Set username permanently

hostnamectl set-hostname bigdata01
vi /etc/hostname   
Delete the original name, change it to a new name, save it and use this method, which requires restarting the computer.

4. Set the corresponding relationship between user name and IP

vi /etc/hosts

5. About firewall settings

About firewall commands:
systemctl status firewalld
systemctl stop firewalld turns off the firewall, but after booting, the firewall will still be turned on.
systemctl  start firewalld
systemctl  restart firewalld
Firewall startup command:
systemctl disable firewalld does not start at boot
systemctl enable firewalld  

Guess you like

Origin blog.csdn.net/weixin_53083884/article/details/132739192