First, modify the network parameters
Under Linux, modification parameters are divided into temporary modifications and permanent modifications . A parameter that is temporarily modified (modified by a command) restarts the service or system and disappears. Permanent modification (by modifying the corresponding configuration file) is still valid after a reboot. ( note : Parameters modified by the command generally do not write to the appropriate configuration file, but the system and version differ, the situation may vary)
1. Modify Host Name
Windows: Host names cannot be duplicated on the same network
NetBIOS (network basic input and output system), the Computer name resolve to IP address
Network Name Service for Windows through WINS service
\\192.168.1.1 (UNC path)
Linux:hostname View
Temporarily modify host Name: (Re-login shell to take effect)
hostname hostname (to follow FQDN Standard: Fully qualified domain name)
Permanently modify the hostname: (restart Effective)
Modify/etc/sysconfig/network to permanently change host name
The file contents are as follows
Networking=yes using the IPv4 network
Hostname= Host Name
2. Modify the IP address
Ifconfig view
Temporary modification:
Ifconfig interface IP address netmask subnet mask temporary configuration IP
Ifconfig can also set a virtual interface for the network card (for testing)
Ifconfig Interface: Serial number IP address netmask subnet mask temporary configuration Virtual interface Sequence number 0 represents 1th, 1 for 2nd, and so on.
For example, I set up a website, the original address is 251, now I want to test the new features of my site, that after adding a new feature can be temporarily configured to a 252 IP address, and then I myself in my network to do the test, so that both can complete my test, can also not affect the original 251 of the user's access.
Permanent configuration:
Modify the/etc/sysconfig/network-scripts/ifcfg-interface file
Device= NIC Name
Hwaddr= the current network card MAC address (hardware address) Do not modify, using the system default assigned!!
Type= network card Type (Ethernet Ethernet card)
Uuid= the ID number of the current network card (do not modify, use the system default assigned!) )
Onboot= NIC is self-booting
Whether the nm_controlled NIC is controlled by the NetworkManager service (the daemon of the NIC)
Bootproto=ip get mode static manual DHCP automatic
Ipaddr=ip Address
netmask= Subnet Mask
Save exit after modification, execute ifconfig command view, ( Note: Some versions will take effect automatically) if not automatically, use Services network restart (restart all network parameters, load all the NICs, including all network configuration , DNS, Gateway) or use Ifdown eth0;ifup eth0 to turn off a network card ( Note:eth0 is the network card you want to restart)
Note: You can also use the Setup command to configure IP in a graphical interface, but Setup cannot set port bindings (Setup commands are available only in the Redhat series)
3, modify the gateway (refer to) cross-network segment communication, used to specify the network exit
Routing (with fixed target)
Temporary entry into force:
Add a default gateway
Route add default GW gateway IP address
Adding Route Records
Route add-net Target Segment GW Gateway IP address
Route-n viewing gateways and routing information
Permanent entry into force:
Modifying the/etc/sysconfig/network-scripts/ifcfg-interface
Add to:
gateway= Gateway IP Address
4. Domain Name
Modifying the/etc/sysconfig/network-scripts/ifcfg-interface
dns1= Configuring DNS server addresses
[dns2= Configure DNS server address]
domain= the domain name of the target domain is generally useless.
When configured, it is automatically added to the/etc/resolv.conf
5. Local parsing (faster than network parsing)
Modify the/etc/hosts file
Purpose: Save the mapping record of host name and IP address
Format: IP address domain name (you can also add aliases)
6. Network test
Netstat view information about the network interface, listening status, etc.
Recv-q received data queue Send-q data queue sent
Should all be 0, if not 0, indicating that some data is already queued, there may be a problem
Netstat napt all TCP-related ports and states
Traceroute the number of network nodes tested to the target network
Traceroute IP Address
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/73/50/wKioL1X6NvDQrnRFAADk-LYY5cE904.jpg "title=" Picture 1.png "alt=" Wkiol1x6nvdqrnrfaadk-lyy5ce904.jpg "/>
As long as a normal connected network can see its records, can be used to troubleshoot network problems, to identify the problem of the line
Ping Test network connectivity test if the target host is alive
-c number specified number of times
-I 0.1 Specify the interval (in seconds for script testing)
-W number Specifies the wait time (in seconds)
iptables-a input-p icmp-j DROP does not accept the ping command
Traceroute and pings are typical applications for ICMP (Internet Control Message Protocol)
7.ARP address resolution, convert IP address to MAC address
RARP Reverse Address Resolution Protocol converts MAC address to IP address
ARP spoofing: A machine to the Internet, to the request to the gateway, the gateway address will be filled in the configuration of this machine card (LAN with the gateway communication with the MAC), need to send an ARP broadcast, request the MAC address of the gateway. But if in this process, if there is a network management software or hacker attacks, the gateway did not give me back to the Mac, a third party responded to me. But for me I do not know that someone is lying to me, I receive what will be filled in the network card configuration, with this wrong MAC address to communicate. The wrong MAC address is probably the machine that installed the network management software, it will be the user all the Internet requests are not directly sent to the gateway, but through the machine to do a forwarding. That machine can do a lot of restrictions on the user's access to the internet operation.
1) Install the package
Rpm-ivh
Dsniff libnet Libnids Ssldump
2) arpspoof-i ETH0-T source host target host
Vim/etc/sysctl.conf Modifying the configuration file for kernel parameters
Net.ipv4.ip_forward = 1 indicates support for forwarding of IPv4 packets
Perform
Sysctl-p Refresh the configuration just now
3) iptables-a forward-s source host-j DROP refuses to forward data for the source host
Arp-a viewing the ARP cache table on the host
Prevent ARP Spoofing
Arp-s IP address MAC address binding
The host's IP address and MAC address are bound together, later to communicate with the IP address, direct communication with it, will not broadcast in the network
After the machine is installed, ping the gateway and record the MAC address of the gateway, and if there is no record, you can only view the Mac before the host to ensure the correct MAC address.
manually completed, restart after the failure (writes the binding to the user profile or to the startup script)
If automatic learning is obtained, update according to aging time (default 300s)
arp-d Delete
8.nmap Network Port Scan
Nmap IP address scans open services on the host
Nmap 192.168.1.1-10 Scan multiple consecutive IP addresses
Nmap 192.168.1.0/24 or specific IP address/24 Scan a network segment
NMAP-SL 192.168.1.0/24 View a list of previously scanned hosts
Nmap 192.168.1.0/24 -exclude 192.168.1.111 do not scan 111
Nmap-p Port 1, Port 2,... IP address scans the specified port of an IP
The status of the host can be quickly located
NMAP-SV Port 1, Port 2,... IP address scan target host Specifies the version of the port
This article is from the "New" blog, be sure to keep this source http://niuzhiqiang.blog.51cto.com/10717322/1695636
Network Configuration under Linux