Linux11&12

Source: Internet
Author: User
Tags scp file tar extract nameserver rsync

###################

# # # #11. Manage Network # # #

###################

# # # #1. Basic IP Knowledge # #

1.ipv4

2 binary 32-bit-----10-binary

172.25.0.10/255.255.255.0

172.25.0.10:ip Address

255.255.255.0: Subnet Mask

Subnet Mask 255-bit corresponding IP bit for network bit

Subnet Mask 0 corresponds to the IP bit master camera

# # # #2. Configuring ip####

<< Graphics >>

1. Graphical interface

Nm-connection-editor

2. Text Graphics

Nmtui

<< commands >>

Ifconfig network card IP netmask # #临时设定

NMCLI Connection Add type Ethernet con-name WESTOS ifname eth0 AutoConnect Yes

NMCLI Connection Add type Ethernet con-name WESTOS ifname eth0 ip4 ip/24

NMCLI Connection Delete Westos

NMCLI Connection Show

NMCLI Connection down Westos

NMCLI Connection up Westos

NMCLI connection Modify "Westos" Ipv4.addresses newip/24

NMCLI connection Modify "Westos" Ipv4.method <auto|manual>

NMCLI Device Connect eth0

NMCLI Device Disconnect Eth0

NMCLI Device Show

NMCLI Device status

<< Files >>

DHCP # #动态获取

Vim/etc/sysconfig/network-scripts/ifcfg-eth0

Device=eth0 # #接口使用设备

BOOTPROTO=DHCP # #网卡工作模式

Onboot=yes # #网络服务开启时自动激活

Name=eth0 # #网络接口名称

:Wq

Systemctl Restart Network

Static|none # #静态网络

Vim/etc/sysconfig/network-scripts/ifcfg-eth0

Device=eth0 # #设备

Bootproto=static|none # #设备工作方式

Onboot=yes # #开启网络服务激活设备

Name=eth0 # #网络接口名称

IPADDR=172.25.0.100 # #IP

netnask=255.255.255.0 | PREFIX=24 # #子网掩码

# # # #3. Gateway Gateways # # #

1. Routers

The main function is to make NAT

Dnat Destination Address translation

Snat Source Address translation

2. Gateways

The IP on the router and itself in the same network segment

3. Setting up the Gateway

Systemctl Stop Netwrokmanager

Vim/etc/sysconfig/network # #全局网关

gateway= Gateway IP

vim/etc/sysconfig/network-scripts/ifcfg-NIC configuration file # #网卡接口网关

gateway= Gateway IP

Systemctl Restart Netwrok

Route-n # #查询网关

Kernel IP Routing Table

Destination Gateway genmask Flags Metric Ref use Iface

0.0.0.0 (Gateway) 172.25.0.254 0.0.0.0 UG 0 0 0 eth0

172.25.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0

# # # #5. dns####

1.dns

DNS is a single server

This server provides the ability to answer the client hostname and IP correspondence

2. Setting up DNS

Vim/etc/resolv.conf

NameServer DNS Server IP

Eg:nameserver 172.25.254.254

vim/etc/sysconfig/network-scripts/ifcfg-NIC configuration file

Dns1=dns Server IP

3. Local parsing file

Vim/etc/hosts

IP Host name

4. Local resolution of file and DNS read priority tuning

/etc/nsswitch.conf

#hosts: DB Files Nisplus NIS DNS

Hosts:files DNS # #files代表本地解析文件, DNS on behalf of the DNS server, that priority in the front

Configuration of the 5.DHCP service

LINUX11:

1. Creating the Set-ip-tool command in the system requires the following

when Set-ip-tool 172.25.254.x is executed in the system

*) will automatically display the output of the ifconfig command

*) System IP is set to: 172.25.254.X

*) The system gateway is set to: 172.25.254.250

*) The system DNS is set to: 172.25.254.250

#################################

# # # #12. File transfer between different systems # # # #

#################################

# # # #1. File Archive # # #

1.

File archiving, which is to turn multiple files into an archive file

2.

Tar C # #创建

F # #指定归档文件名称

t # #显示归档文件中的内容

R # #向归档文件中添加文件

--get # #取出单个文件

--delete # #删除单个文件

X # #取出归档文件中的所有内容

-C # #指定解档目录

-Z # #gz格式压缩

-J # #bz2格式压缩

-J # #xz格式压缩

Eg:[[email protected] ~]# tar CF etc.tar/etc/# #把etc下的内容归档etc. Tar to the current directory

[Email protected] ~]# du-sh/etc/

35m/etc/

[Email protected] ~]# du-sh Etc.tar # #压缩后文件的大小

31M Etc.tar

[[Email protected] mnt]# tar tf etc.tar file # #显示归档文件etc. tar file contents

[[Email protected] mnt]# tar RF Etc.tar File # Add File in #向归档文件etc. tar

[[Email protected] mnt]# tar f etc.tar--get file # #从归档文件etc. tar to remove file files

[Email protected] mnt]# tar XF Etc.tar # #显示归档文件etc all file contents in tar

[[Email protected] mnt]# tar f etc.tar--delete file # #从归档文件etc. tar Delete file

[[Email protected] mnt]# tar xf/mnt/etc.tar-c/root/desktop/# #把/mnt/etc.tar Extract to Desktop

# # # #2. Compression # # #

Gz

Gzip Etc.tar # #压缩成gz格式

Gunzip etc.tar.gz # #解压gz格式压缩包

Tar zcf etc.tar.gz/etc # #把文件归档为tar并压缩成gz

Tar zxf etc.tar.gz # #解压并解档gz格式压缩包

bz2

bzip2 Etc.tar # #压缩成bz2格式

BUNZIP2 etc.tar.bz2 # #解压bz2格式压缩包

Tar jcf etc.tar.bz2/etc # #把文件归档为tar并压缩成bz2

Tar jxf etc.tar.bz2 # #解压并解档bz2格式压缩包

Xz

XZ Etc.tar # #压缩成xz格式

Unxz ETC.TAR.XZ # #解压xz格式压缩包

Tar Jcf etc.tar.xz/etc # #把文件归档为tar并压缩成zx

Tar jxf etc.tar.xz # #解压并解档xz格式压缩包

Zip

Zip-r Etc.tar.zip Etc.tar # #压缩成zip格式

Unzip Etc.tar.zip # #解压zip格式压缩包

# # # #3. File transfer in the system # # #

SCP file [email protected]:/dir # #上传

SCP [email Protected]:/dir/file/dir # #下载

rsync [parameter] file [email protected]:/dir ****************

Rsync-r # #同步目录

-L # #不忽略链接

-P # #不忽略文件权限

-T # #不忽文件时间戳

-G # #不忽文件所有组

-O # #不忽文件所有人

-D # #不忽略设备文件

linux12:

1. Package the/etc directory in the server host and compress it into/mnt, with the name etc.tar.gz

in the server host:

[[email protected] Desktop] #tar zcf/mnt/etc.tar.gz/etc

2. Copy the etc.tar.gz from the server host to the/MNT in the desktop host

in the desktop host:

[[email protected] Desktop] #scp [email protected]:/mnt/etc.tar.gz/mnt

3. Synchronize all files in/etc in the server host to the desktop host in/mnt, including linked files

in the server host:

[[email protected] Desktop] #rsync-rl/etc/[email protected]:/mnt

Linux11&12

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.