-

二:临时配置网络(ip,网关,dns)+永久配置
临时配置:

[root@nfs-server ~]#
ifconfig

ens32:
flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

inet
192.168.152.134  netmask 255.255.255.0  broadcast 192.168.152.255

inet6
fe80::e33a:cec4:b0d4:c884  prefixlen 64  scopeid 0x20<link>

ether
00:0c:29:f7:dc:59  txqueuelen 1000  (Ethernet)

RX
packets 241828  bytes 275307222 (262.5 MiB)

RX
errors 0  dropped 0  overruns 0  frame 0

TX
packets 7200  bytes 1083100 (1.0 MiB)

TX
errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo:
flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

inet
127.0.0.1  netmask 255.0.0.0

inet6
::1  prefixlen 128  scopeid 0x10<host>

loop 
txqueuelen 1  (Local Loopback)

RX
packets 327  bytes 33260 (32.4 KiB)

RX
errors 0  dropped 0  overruns 0  frame 0

TX
packets 327  bytes 33260 (32.4 KiB)

TX
errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@nfs-server ~]#
ifconfig ens32 192.168.152.135

[root@nfs-server ~]# route
-n

Kernel IP routing table

Destination    
Gateway         Genmask       Flags
Metric Ref   Use Iface

192.168.152.0  
0.0.0.0        
255.255.255.0   U    
0      0        0
ens32

[root@nfs-server ~]# route
add default gw 192.168.152.2

[root@nfs-server ~]# route
-n

Kernel IP routing table

Destination    
Gateway         Genmask      
Flags Metric Ref  Use Iface

0.0.0.0        
192.168.152.2  
0.0.0.0         UG   
0      0        0
ens32

192.168.152.0  
0.0.0.0        
255.255.255.0   U    
0      0        0
ens32

[root@nfs-server ~]# cat
/etc/resolv.conf

# Generated by
NetworkManager

search localdomain

nameserver 192.168.152.2

nameserver 202.106.0.20

永久配置:

[root@nfs-server ~]# cat
/etc/sysconfig/network-scripts/ifcfg-ens32

TYPE=Ethernet

BOOTPROTO=dhcp

IPADDR=192.168.152.134

NETMASK=255.255.255.0

GATEWAY=192.168.152.2

DNS1=192.168.152.2

DNS2=202.106.0.20

DEFROUTE=yes

PEERDNS=yes

PEERROUTES=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_PEERDNS=yes

IPV6_PEERROUTES=yes

IPV6_FAILURE_FATAL=no

IPV6_ADDR_GEN_MODE=stable-privacy

NAME=ens32

UUID=9eff3909-2614-4df9-80c9-a6a7d9f1be28

DEVICE=ens32

ONBOOT=yes

[root@nfs-server ~]#
systemctl restart network

三:为集群内的机器设定主机名,利用/etc/hosts文件来解析自己的集群中所有的主机名,相应的,集群的配置应该改成使用主机名的方式

修改主机名:
hostname python_web1
cat /etc/hostname 
python_web1
修改host文件:
[root@python_web1 ~]# cat /etc/hosts 
192.168.2.3 python_web1
[root@python_web1 ~]# ping python_web1

四:ssh登录,scp上传、下载,ssh秘钥登录,修改ssh
server端的端口为8888然后进行登录和scp测试
SSH登录:

[root@proxy-nfs ~]# scp
/etc/hosts web01:/tmp

The authenticity of
host 'web01 (192.168.152.135)' can't be established.

ECDSA key
fingerprint is 4c:ee:a3:f1:5c:37:43:32:bd:06:4e:cc:3f:5a:0a:04.

Are you sure you want
to continue connecting (yes/no)? yes

Warning: Permanently
added 'web01,192.168.152.135' (ECDSA) to the list of known hosts.

root@web01's password:

hosts                                                                    
100%  274     0.3KB/s  
00:00

[root@proxy-nfs ~]# scp
web01:/tmp/hosts .

root@web01's password:

hosts                                                                    
100%  274     0.3KB/s  
00:00

[root@proxy-nfs ~]# ls -l
hosts

-rw-r--r-- 1 root root 274
Mar 21 15:05 hosts

秘钥登录:

[root@proxy-nfs ~]#
ssh-keygen

Generating public/private rsa
key pair.

Enter
file in which to save the key (/root/.ssh/id_rsa):

Enter passphrase
(empty for no passphrase):

Enter same passphrase
again:

Your identification has
been saved in /root/.ssh/id_rsa.

Your public key
has been saved in /root/.ssh/id_rsa.pub.

The key
fingerprint is:

29:90:f7:3a:24:0a:e2:f9:22:ec:f4:07:75:7c:10:6b
root@proxy-nfs

The key's randomart
image is:

+--[ RSA 2048]----+

|      
..        |

|     .
..        |

|    o
oE.        |

|    
+.+ o       |

|o   o +
S        |

|o..o o
o         |

|.+. .
o          |

|ooo  .
.         |

|o..o.           
|

+-----------------+

[root@proxy-nfs ~]#
ssh-copy-id -i web01

/usr/bin/ssh-copy-id: INFO:
attempting to log in with the new key(s), to
filter out any that are already installed

/usr/bin/ssh-copy-id: INFO:
1 key(s) remain to be installed -- if you are prompted now
it is to install the new keys

root@web01's password:

Number of key(s) added: 1

Now try logging into the
machine, with:   "ssh 'web01'"

and check to make sure that
only the key(s) you wanted were added.

[root@proxy-nfs ~]#

[root@proxy-nfs ~]#
ssh-copy-id -i web02

The authenticity of
host 'web02 (192.168.152.136)' can't be established.

ECDSA key
fingerprint is 4c:ee:a3:f1:5c:37:43:32:bd:06:4e:cc:3f:5a:0a:04.

Are you sure you want to continue connecting
(yes/no)? yes

/usr/bin/ssh-copy-id: INFO:
attempting to log in with the new key(s), to
filter out any that are already installed

/usr/bin/ssh-copy-id: INFO:
1 key(s) remain to be installed -- if you are prompted now
it is to install the new keys

root@web02's password:

Number of key(s) added: 1

Now try logging into the
machine, with:   "ssh 'web02'"

and check to make sure that
only the key(s) you wanted were added.

[root@proxy-nfs ~]#
ssh-copy-id -i web03

The authenticity of host 'web03
(192.168.152.137)' can't be established.

ECDSA key
fingerprint is 4c:ee:a3:f1:5c:37:43:32:bd:06:4e:cc:3f:5a:0a:04.

Are you sure you want
to continue connecting (yes/no)? yes

/usr/bin/ssh-copy-id: INFO:
attempting to log in with the new key(s), to
filter out any that are already installed

/usr/bin/ssh-copy-id: INFO:
1 key(s) remain to be installed -- if you are prompted now
it is to install the new keys

root@web03's password:

Number of key(s) added: 1

Now try logging into the
machine, with:   "ssh 'web03'"

and check to make sure that
only the key(s) you wanted were added.

# 修改SSH端口

[root@proxy-nfs ~]# ssh
web01

Last login: Tue Mar 21
15:08:30 2017 from proxy-nfs

[root@web01 ~]# sed -i
s'/^#Port 22/Port 8888/g' /etc/ssh/sshd_config

[root@web01 ~]# grep 8888
/etc/ssh/sshd_config

Port 8888

[root@web01 ~]# exit

logout

Connection to web01 closed.

[root@proxy-nfs ~]# ssh
web02

Last login: Tue Mar 21
14:53:19 2017 from 192.168.152.1

[root@web02 ~]# sed -i
s'/^#Port 22/Port 8888/g' /etc/ssh/sshd_config

[root@web02 ~]# grep 8888
/etc/ssh/sshd_config

Port 8888

[root@web02 ~]# exit

logout

Connection to web02 closed.

[root@proxy-nfs ~]# ssh
web03

Last login: Tue Mar 21
14:53:20 2017 from 192.168.152.1

[root@web03 ~]# sed -i
s'/^#Port 22/Port 8888/g' /etc/ssh/sshd_config

[root@web03 ~]# grep 8888
/etc/ssh/sshd_config

Port 8888

[root@web03 ~]# exit

logout

Connection to web03 closed.

[root@proxy-nfs ~]#

# SCP 远程拷贝文件

[root@proxy-nfs ~]# touch
oldgirl.txt

[root@proxy-nfs ~]# scp
oldgirl.txt web01:/tmp

oldgirl.txt                                                                                                                         
100%    0     0.0KB/s  
00:00

[root@proxy-nfs ~]# scp
web01:/etc/passwd .

passwd                                                                                                                              
100% 2375     2.3KB/s   00:00

五:整理bash命令类型,验证寻找一个命令的优先级

# 以ls命令为例

命令分为:

==> alias
  ==> Compound Commands
    ==> function 
      ==> build_in
        ==> hash
          ==> $PATH
            ==> error: command not found

获取一个命令会按照上述优先级取寻找,先找同名的alias命令,再找compound命令。。。

 

linux---网络相关配置,ssh服务,bash命令及优先级,元字符的更多相关文章

  1. Linux网络相关配置

    一.修改网卡相关配置 Linux网络参数是在/etc/sysconfig/network-scripts/ifcfg-eth0中设置,其中ifcfg-eth0表示是第一个网卡,如果还有另外一块网卡,则 ...

  2. Linux网络属性配置命令和管理详解

    一.Linux网络属性配置 1.Linux主机接入到网络方式 IP/NETMASK:实现本地网络通信 路由(网关):可以进行跨网络通信 DNS服务器地址:基于主机名的通信,Linux可以有三个DNS地 ...

  3. Linux下安装并配置SSH服务

    一.使用命令检测Linux系统上是否已经安装了SSH服务:(命令:rpm -qa |grep ssh) 二.如果没有安装SSH软件包,可以通过yum 或rpm安装包进行安装(命令:yum instal ...

  4. Linux 网络相关命令 Cheat Sheet

    以下漫画形式呈现的常用 Linux 网络相关命令速查表来自 twitter -

  5. 10.11 Linux网络相关 10.12 firewalld和netfilter 10.13 netfilter5表5链介绍 10.14 iptables语法

    Linux网络相关 ifocnfig 查看网卡ip(yum install net-tools) ip add 查看网卡 ip add = ifocnfig ifconfig 不显示down掉的网卡, ...

  6. Linux网络基础配置

    这是看itercast视频的笔记 Linux网络基础配置 以太网连接 在Linux中,以太网接口被命令为:eth0, eth1等, 0,1代表网卡编号 通过lspci命令可以查看网上硬件信息(如果是u ...

  7. Linux入门-6 Linux网络基本配置

    1. 网络基础知识 网络编址 IP编址 子网掩码 同一网络主机之间通信--MAC地址 不同网络之间的通信 路由 域名 DNS 基本网络参数 2. Linux网络基础配置 以太网连接 配置网络信息 网络 ...

  8. Linux网络相关、firewalld和netfilter、netfilter5表5链介绍、iptables语法 使用介绍

    第7周第3次课(5月9日) 课程内容: 10.11 Linux网络相关10.12 firewalld和netfilter10.13 netfilter5表5链介绍10.14 iptables语法 扩展 ...

  9. CentOS7系列--2.2CentOS7中配置SSH服务

    CentOS7配置SSH服务 1. SSH配置 1.1. 使用SSH服务更加安全 [root@centos7 ~]# vi /etc/ssh/sshd_config 设置如下 PermitRootLo ...

  10. Linux centos7 Linux网络相关、firewalld和netfilter、netfilter5表5链介绍、iptables语法

    一. Linux网络相关 yum install net-tools ifconfig查看网卡ip ifup ens33开启网卡 ifdown ens33关闭网卡 设定虚拟网卡ens33:0 mii- ...

随机推荐

  1. WebBrowser自动填充打开文件对话框

    WebBrowser自动填充打开文件对话框   在使用WebBrowser编写自动表单填写软件的时候,不知道大家是否遇到国填写文件选择表单的情况.遇到这种情况的时候,无法直接队Html元素赋值,必须模 ...

  2. SSH查看Linux系统是32位还是64位?

    Linux下如何明确地查看操作系统的位数   如何知晓操作系统是32位还是64位?这里介绍一种简单的方式: [root@localhost mysql-5.1.57]# getconf LONG_BI ...

  3. JQuery点击标题实现div的收缩

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  4. __new__方法以及TypeError: object() takes no parameters的处理

    一些python书或博客将类中的__init__方法称为构造函数,而实际上这种说法是不严格的,因为创建实例的方法是__new__,实例初始化的方法是__init__.__new__方法会返回一个实例, ...

  5. 基于EasyUI 快速搭建权限管理平台

    前言: 一.用户角色权限设计思路: <1>不同职责的人员,对于系统操作的权限应该是不同;<2>可以对“组”进行权限分配;<3>权限管理系统应该是可扩展的;<4 ...

  6. java的接口为什么不能实例化

    java的接口为什么不能实例化呢?首先,我们需要明白实例化的含义.实例化实际意义是在jvm的堆中开辟出一块内存空间,比如Student s = new Student();此处声明Student对象s ...

  7. QML学习之浅谈Window

     转载地址:http://blog.csdn.net/kanchuan1905/article/details/53762788 在Qt Quick的世界里,Window对象用于创建一个与操作系统相关 ...

  8. Ubuntu16.04桌面版 连接到ftp服务器

    Ftp服务器在不同的网段,需要临时添加网段 不同网段临时添加方法: root@xzrs:/home/rxf# ip addr add 10.1.2.127/24 dev enp0s25 电脑左侧“连接 ...

  9. [Face++]Face初探——人脸检测

    经过了强烈的思想斗争才把自己拖到图书馆做毕设T^T anyway, 因为毕设里面有人脸识别的部分,所以就想找个现成的api先玩玩,于是就找到最近很火的face++:http://www.faceplu ...

  10. 20145303刘俊谦 《Java程序设计》第十周学习总结

    教材学习内容总结 网络编程 就是在两个或两个以上的设备(例如计算机)之间传输数据.程序员所作的事情就是把数据发送到指定的位置,或者接收到指定的数据,这个就是狭义的网络编程范畴.在发送和接收数据时,大部 ...