Linux Basics (04), feature configuration (tuning firewall, static IP, environment variables)

Source: Internet
Author: User

Directory

First, the CentOS firewall

Second, the VMware Network connection mode

2.1. Connection method: Bridge, NAT, host only

2.2. Frequently Asked Questions

Third, the CentOS configuration static IP

IV. Environment variables

Some notes:

The direct command to change the environment variable is temporary, such as export path=aaa

The files entered into the/etc/profile are permanently added and are valid for all users.

First, the CentOS firewall

1.1. View Firewall

Systemctl Status [Start | stop | restart | disable | enable] Firewalld

2.2. Turn off the firewall

Systemctl Stop FIREWALLD//temporary shutdown, firewall on after virtual machine restart

Systemctl Disable Firewall//closed permanently if not turned on

Second, the VMware Network connection mode

2.1. Connection method: Bridge, NAT, host only

Bridge Connection:

Host network is disconnected, the client is not interoperable, the client and host are not interoperable // Convenient

NAT:

Host network disconnect, between clients, client and host can also be interoperable / secure, reliable

Host only:

Equivalent to NAT cannot connect to Internet // Security

2.2. Frequently Asked Questions

Q:NAT is not connected to the Internet, but the host network is normal:VMnet8 Virtual net

1, look at the subnet IP, such as: 192.168. 0, which shows that all virtual machine segments established in NAT mode are 192.168. start with one

    The IP address of the VMNET8 is 192.168. one. 1

Windows---VMnet8---centos

2. Check if the IP address of the VMNET8 is 192.168. one. 1

1) If not, modify the IP address (Windows side)

2) Modify the method: Double-click the VMnet8 ===> property ====> Internet Protocol version 4 ===> manually modify the IP address (192.168. one. 1)

Third, the CentOS configuration static IP

Cause: The network connection between all clients is guaranteed to be fixed

How to configure:

1. Modify the file

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

Modify the information to read as follows:

Type=Ethernetbootproto=StaticDefroute=Yespeerdns=yespeerroutes=Yesipv4_failure_fatal=Noipv6init=noipv6_autoconf=Noipv6_defroute=Noipv6_peerdns=noipv6_peerroutes=Noipv6_failure_fatal=Noipv6_addr_gen_mode=stable-Privacyname=Ens33uuid=9b4c784c-8910-4fb7-a1f4-5be34cc970f3device=Ens33onboot=yesipaddr=192.168.**.100PREFIX=24GATEWAY=192.168.**.2DNS=192.168.**.2

2. Restart the network adapter

  Service Network Restart

3. See if the IP address is successfully modified in VMware virtual machine

IP addr

4. Setting up the Client connection extranet

Modify Files sudo vi/etc/resolv.conf

Add DNS Address:

NameServer 192.168. * *. 2

iv. Modifying environment variables

Temporary modification of environment variables (modification fails after reboot)

Export Path=tom temporarily modify environment variable to Tom

Export ps1= ' [\[email protected]\h \w]\$ ' Modify command prompt

Permanently modify environment variables

1. Edit the environment variable file:

sudo vi/etc/profile

Note: Valid for all users after modification

2. Write environment variables, such as configure command prompt format:

Export ps1= ' [\[email protected]\h \w]\$ '

3. Save and exit

4. Make the environment variable effective:

Soure/etc/profile

Linux Basics (04), feature configuration (tuning firewall, static IP, environment variables)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.