IP address configuration and mail order

A: IP address configuration

 1: Profile: vi / etc / sysconfig / network-scripts / ifcfg-eth0

 2: Restart network services: service network restart

 3: Virtual machines need to bridge to a wired LAN, sick Network Service Restart

  Copy the image may be necessary to reset the UUID (unique identifier), replication may result in a local area network UUID two overlapping lead to problems such as duplicate IP

 [root@localhost~]#vi /etc/sysconfig/network-scripts/ifcfg-eth0

# Delete the MAC address line

[root@localhost~]

#rm-rf  /etc/udev/rules.d/70-persistent-net.rules

# Delete MaC address and UUID bind file

[root@localhost ~]# reboot

# Reboot Linux

 

4: ifconfig command , ifconfig command the most important role is to look at the IP address information, enter directly ifconfig command.

 Check ip address ip addr.

 

5: ping command

ping command is a common network, the main network is detected by the ICMP protocol, a communication network where the test host. Basic information of this ping command is as follows.

   -b: broadcast address added later, for the entire segment detect

-c count: Specifies the number of ping for

Specifies the size of the probe packets: -s bytes

 

6 .netstat

netstat command to view network status and can be viewed to port the machine is turned on, you can also see which client connections.

netstat [options]

Options:

-a: lists all the network status, including Socket program

-c Seconds: Specifies the network every few seconds to refresh the state

-n: Use IP address and port number is displayed, not using a domain name with the service name

-p: PID and display program name

-t: display protocol using TCP port connection status

-u: Use display port UDP protocol connection status

-l: Displays only the connection status monitor

-r: Displays the routing table

Example: View the machine is turned port number netstat - tuln

The output of this command more.

Proto: protocol network connection, the general protocol is TCP or UDP protocol.

 Recv-Q: represents the data received, has a local buffer, but the process has not yet been removed.

 Send-Q: denotes a transmission from the machine, the other party has not received the data, remain in a local buffer, generally do not have the flag ACK packet.

 Local Address: IP address and port number of the machine.

 Foreign Address: IP address and port number of the remote host.

 State: state. Common states are the following.

- LISTEN : listening state, only need to listen to the TCP protocol, UDP protocol and does not require monitoring.

- the ESTABLISHED : state of the connection has been established. If you use the "-l" option, you can not see the state of the connection has been established.

- SYN_SENT: SYN packet to initiate, initiate data packet is connected.

- SYN_RECV: receiving a data packet connection active.

- FIN_WAIT1: being broken connections.

- FIN_WAIT2: The connection has been interrupted, but the other side is waiting for the host to confirm.

- TIME_WAIT: connection has been interrupted, but the socket is still waiting for the end of the network.

- the CLOSED : The socket is not being used.

In these states, we are the most commonly used is the LISTEN and ESTABLISHED states, one is listening behalf, on behalf of another connection has been established

 

7: write command to send messages to other users.

   w can view the user's login

   write user1 pts/1

   Basic information write command is as follows.

 command name: write.

 English original intent: send a message to another user.

 the path: / usr / bin / write.

 execute permissions: All users.

 Functional Description: send a message to other users.

 

8 . wall command

wall command to send a message to all logged-on user, including your own.

When executed, the information can be added after the wall command needs to be transmitted, for example:

[root@localhost ~]# wall "I will be in 5 minutes to restart, please save your data"

 

9. mail order

mail is a Linux mail client command, you can use this command to send messages to other users. Basic information of mail order

as follows.

Example 1: send a message

If we want to send messages to other users, you can execute the following command:

[root@localhost ~]# mail user1

Subject: hello <- mail headers

Nice to meet you <-! Mail details

. <-. "" To end the use of e-mail input

# Send mail to user user1

We received messages are stored in "/ var / spool / mail / username", each user has a user name names in their own mailboxes.

 

Example 2: send the file contents

If we want the contents of a file sent to the specified user, you can execute the following command:

[root@localhost ~]# mail -s "test mail" root < /root/anaconda-ks.cfg

Options:

-s: Specifies the message header

# Sends the file to the root user /root/anaconda-ks.cfg

When we write the script, the script may need some of the information is automatically sent to designated users, the information to be sent pre-written document,

It is a very good choice.

 

Example 3: Check the mail has been received

We can execute mail commands directly from the command line, enter the mail interactive commands, you can view here has been received

s mail. E.g:

[root@localhost ~]# mail

Heirloom Mail version 12.4 7/29/08.Type ?for help.

"/var/spool/mail/root": 1 message 1 new

> N 1 root Mon Dec 5 22:45 68/1777 "test mail" <- previously received message

>N 2 root Mon Dec 5 23:08 18/602 "hello"

Sender ID # unread Time Title

& <- wait for user input commands.

 

Guess you like

Origin www.cnblogs.com/love-life-insist/p/11409563.html