Linux Network Setup (second edition)--linux network settings

Source: Internet
Author: User
Tags name database

LinuxNetwork Settings--Network configuration fileWith the commandNetwork configuration file

1./etc/sysconfig/network-scripts/ifcfg-eth0# "Save IP address and gateway"

[ set static IP]

ipaddr= new IP address # This option sets the IP address if bootproto=dhcp is set , automatically get IP address, there will be no option , otherwise bootproto=no

gateway= Gateway # Specify Gateway

broadcast= Broadcast Address

netmask= Subnet Mask

2,/etc/sysconfig/network#保存了本机主机名

Hostname= hostname # Specifies the host name, which is not available if DHCP Auto-assignment is specified because the hostname is localhost

3./etc/rc.d/init.d/network Start/stop/restart Network startup script

or service network restart

If a static IPis set, restart the system, or reload the following startup script, the settings will take effect, but recommend the latter!

4,/etc/hosts# saved the domain name database

5,/etc/services# Save the Network service information, such as: Port and transport Protocol

6./etc/resolv.conf# Specify DNS server address

nameserver [DNS server IP address ] #添加DNS server , plus spaces to specify multiple DNS server address, you can use up to 3 a

Attached- the service program may not use a fixed port, but generally the externally exposed WebServer will not change the port , but like SSH generally recommended changes, you can avoid scanning

Nmap [IP address ]# Scan the other host to enable those services, but he will only scan the port by default or a well-known service

 Network Management Commands

1.ifconfig# View network Port settings

Ifconfig eth0 up/down# start / close Nic

2,ethtool [NIC name]# detect network card line connection

Ethtool eth0

Ethtool Wlan0

Many times, a server will have more than one network card, at this time, theethtool command is very important!

3,arp# view arp table information, such as the previous


4.Ping# probe remote host

ping-c 10-s IP Address #-c Specifies the number of pings,-s specifies the size of the sending packet , pay attention to the packet loss rate at Ping pass

5.Route # Operation routing Table

Route add default GW 192.168.14.100# Add a gateway without modifying the configuration file

"But it's best to modify the configuration file"

"Zerba routing Software"

6.traceroute# View routing path

Traceroute www.163.com # He will list all the routers and delays that have passed while accessing this host .

7.netstat# monitor network status

netstat-an# View all connections

Netstat-an | grep:80# to see if the Apache service is started

Linux Network Setup (second edition)--linux network settings

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.