Linux Security Basics: network configuration commands and linux basic configuration commands
1. ifconfig view and configure network interface information
(1) set an IP address
Ifconfig eth0 192.168.0.1
(2) temporarily disable or enable the NIC
Ifconfig eth0 down
Ifconfig eth0 up
(3) set the subnet mask
Ifconfig eth0 netmask 255.255.255.0
(4) view the status of the first ENI
Ifconfig eth0
2. Manage route tables and set static routes
Add a route table entry
Del deletes a route table entry.
-C: displays the route Cache Information in the kernel.
-F: displays the routing FIB route table.
(1) Add a route table entry
Route add-net 192.168.0.0 netmask 255.255.255.0 dev eth0
(2) Add a default route
Route add 0.0.0.0 gw
(3) Delete the default route
Route del 0.0.0.0 gw
3. netstat command
List all udp ports: netstat-au
List all tcp ports: netstat-
Show only the listening port: netstat-l
List all tcp listening ports: netstat-lt
The output shows the PID and process name: netstat-p.
4. nslookup command
The nslookup command is used to query the IP address of a machine and its corresponding domain name. It usually requires a Domain Name Server to provide domain name services.
Usage: nslookup [IP Address/domain name]
5. host Command
The host command has the same functions as nslookup. Query the Host IP address or the host name based on the host IP address.
Usage: host [Option] [IP Address/Domain Name/host name]
Common parameters:-a: displays information about the queried domain name, IP address, domain name, or host name.
6. finger command
The finger command is used to query user information.
Parameters:
-L: multi-line display
-S: Single Row display
Lists information about the current logon User: finger-l
7. ping Command
The ping command is used to check whether hosts on the network are working. It sends data packets to the host to determine whether the host is alive.
Usage: ping An IP Address