How to modify IP address, gateway, and DNS in Linux Command Line
This article will briefly describe how to use Linux Command lines to modify IP addresses, gateways, and DNS.
Change the IP address of eth0 to 102.160.1.
Ifconfig eth0 102.160.1 netmask 255.255.255.0
Change
With a virtual machine installed a centos7.0 to play, the installation interface than the original 5.x has undergone a great change, but the process is to get through the small difference, it is not recorded. This time the installation of a pure environment, of course, no desktop, no network connection, here to record the configuration of the network process:1, the virtual device uses the way of bridging, directly connected to the physical network2, cd/etc/sysconfig/network-scripts/#进入网络配置文件目录3,
It's a very simple experience, but it's a summary. Currently in the use of several Ubuntu virtual machines, but the trouble is that the virtual machine IP address is DHCP, will often change. If the direct manual configuration, suffer from do not know how the gateway and DNS configuration (because do not know the details of the virtual machine configuration), and ifconfig can only query Ubuntu
DNS Overview: DNS is the domain Name System, which is a distributed database, organized into a domain hierarchy of the structure of the computer and Network service naming system. Its role is: to transform the domain name into a network can identify the IP address, the results of the query to save, and told the client.
Second,
premise: Virtual machines Linux centOS6.6How Linux sets up fixed IP,DNS, gateways1 , switch to Root Account Number2 , #cd /etc/sysconfig/network-scripts into the settings directory of the NIC3, #vi Cfg-eth0 into the network card configuration file4, the configuration file is as follows5, to setGateways ( Gatefix) to align with the host's gatewaycan set IPADDR Fixed IPand the
Linux Red Hat 5 DNS Server multiple labs detailed setupRequired Packages: ? bind-9.3.3-7.el5.i386.rpm ? Provide main procedures and related documents ? bind-utils-9.3.3-7.el5.i386.rpm ? Provides test tools for DNS servers (such as nslookup, dig, etc.) ? bind-chroot-9.3.3-7.el5.i386.rpm ? Provides a spoofed root directory to enhance its security (var/named/chroot/
= yes # whether to set this network interface when the system starts. If it is set to yes, the device is activated when the system starts.2. Modify the GatewayModify the gateway configuration file of the corresponding Nic[Root @ centos] # vi/etc/sysconfig/networkModify the following contentNETWORKING = yes (indicates whether the system uses the network, which is generally set to yes. If it is set to no, the network cannot be used, and many system service programs cannot be started)HOSTNAME = ce
Ifconfig eth0 new ip
Then edit/etc/sysconfig/network-scripts/ifcfg-eth0 and modify the ip
1. Modify the IP address
[Aeolus @ db1 network-scripts] $ vi ifcfg-eth0
DEVICE = eth0
ONBOOT = yes
BOOTPROTO = static
IPADDR = 219.136.241.211
NETMASK = 255.255.255.255.128
GATEWAY = 219.136.241.254
2. Modify the Gateway
Vi/etc/sysconfig/network
NETWORKING = yes
HOSTNAME =
Modify IP
cmd/c netsh interface ip set address name= "Local Area Connection" Source=static addr=211.82.56.253 mask=255.255.255.0 gateway=211.82.56.1 Gwmetric=1
Modify DNS
cmd/c netsh interface ip set DNS name= "Local Area Connection" Source=static addr=202.99.192.66
Because the company's computer every time the power-on reset assigned IP address is different, which leads to a lot of inconvenient things, so simply lock a fixed IP address, the following is the steps I lock the IP address:1. Set the IP addressVi/etc/network/interfacesAdd the following content:# The Primary network in
Linux configure static IP, set DNS and host name 1: static IP # vi/etc/syssconfig/network-scripts/ifcfg-eth0 DEVICE = eth0 BOOTPROTO = static HWADDR =; here is the physical address of your network card, you do not need to enter ONBOOT = yes IPADDR = 192.168.0.1 NETMASK = 255.255.255.0 NETWORK = 192.168.1.0 BROADCAST = 192.168.1.255 GATEWAY =. Enter your GATEWAY h
A To modify the DNS configuration file for the corresponding network card
sudo vi/etc/resolv.confModify the following content
NameServer 8.8.8.8 #google域名服务器NameServer 8.8.4.4 #google域名服务器
b Modify the configuration file of the gateway that corresponds to the network cardsudo vi/etc/sysconfig/network
Modify the following contentNetworking=yes (Indicates whether the system is using the network, typically set to Yes.) If set to no, the network cannot be
] ~] # Dig-T axfr aliyun.com @ 172.24.8.10 # view secondary DNS Synchronization
1 [[emailprotected] ~]# cat /var/named/slaves/aliyun.com.zone
Note: The secondary DNS resource records are synchronized from the primary DNS and cannot be changed manually.
Windows Client Detection.
Summary:
1. Each DNS
Modify Host name : "Change inside HOSTNAME can"
Vim/etc/sysconfig/network
Nic Eth0 IP modified to 102.168.0.1
Ifconfig eth0 102.168.0.1 netmask 255.255.255.0
Gateway modified to 102.168.0.254
Route add default GW 102.168.0.254
Linux command line modify DNS
echo "NameServer 202.202.202.20" >>/etc/resolv.conf
Can be modified with the VIM command, multip
What is the difference between a WINS server and a DNS server?
For many people, the relationship between the WINS server and the DNS server is still mysterious. However, we hope to clarify this matter with your question.
First,
Use the URL of the page to obtain the IP address written in C:
Generally, a large website may have multiple IP addresses, so it may also have multiple IP addresses.
Using System; using System. collections. generic; using System. linq; using System. net; using System. text; using System. threading. tasks; namespace DNSIP {class Program {static void Main (strin
Ubuntu 16 set Fixed IP address and DNS1. Set the IP addressVi/etc/network/interfacesAdd the following content:# The Primary network interface# ens160 is a network card, do not know what kind of network card, you can use the command IP addr ViewAuto ens160Iface ens160 inet Static# set a fixed IP address, example belowAd
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.