Linux environment set IP and firewall off

Source: Internet
Author: User
Tags nameserver

Confirm Current Network configuration:

[Email protected] ~]# nmcli-p Dev=====================  Status of Devices===================== DEVICE      TYPE State       CONNECTION------------------------------------------------------------------virbr0      Bridge    connected  virbr0     eth0       Ethernet  connected  eth0 lo          loopback  unmanaged  

To set the IP file, modify the following:

##Configure eth0# # vi/etc/sysconfig/network-scripts/ifcfg-eth0hwaddr=00:0c:29:10: A0:dbmacaddr=00:0c:29:10: A0:dbTYPE=Ethernetproxy_method=nonebrowser_only=No# Static IP Address #Bootproto=staticipaddr=192.168.1.249PREFIX=24# Default Gateway IP #GATEWAY=192.168.1.1# DNS Servers #DNS1=118.118.118.1Defroute=Yespeerdns=No# Disable IPv6 #Ipv4_failure_fatal=Noipv6init=NoNAME=Eth0uuid=2734ae8a-4190-4cb9-9b32-4404dfc83e29# Activate on Boot#Onboot=Yes##Configure Default Gateway# # vi/etc/sysconfig/networknetworking=Yeshostname=Centos6gateway=192.168.1.1##Restart Network Interface#/etc/init.d/Network Restart##Configure DNS Server# # Vi/etc/resolv.Confnameserver118.118.118.1 #ReplaceWith your nameserver ipnameserver192.168.1.1 #ReplaceWith your nameserver IP

Open the console and modify the command as follows:

sudo ifconfig eth0 192.168.1.251 netmask 255.255.255.0192.168.1.1echo "nameserver 118.118.118.1 ">/etc/resolv.  echo "NameServer 192.168.1.1" >/etc/resolv.conf

To turn off the firewall and restart the network link:

systemctl Stop firewalldsystemctl disable FIREWALLD/etc/init.d/network restart

To view the current IP through the ifconfig command, if not reflected, you can restart the network link via the Setup screen:

Linux environment set IP and firewall off

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.