linux练习
2019-02-28 本文已影响0人
xm11211
1.简述TCP三次握手
假设客户端是A 服务端是B
(1)A告诉B想要与B建立连接(SYN),同时A进入连接请求已发送的状态(SYN_SENT),等待B的确认
(2)B收到A的连接请求后,回应A你的请求我已收到,我这边确认可以建立(ACK,SYN),确认的同时B进入(SYN_RECRIVED)
A收到B的确认信息后,向B发送确认连接(ACK)
(3)最后A和B之间的连接建立成功,彼此都进入(ESTABLISHED)状态,三次握手就此结束
2、简述TCP和UDP的区别
TCP | UDP |
---|---|
面向连接协议 | 非面向连接协议 |
数据恢复,重传 | 无数据恢复特性 |
3、总结IP地址规划
(1)判断用户对网络以及主机数的需求;
(2)计算满足用户需要的基本网络地址结构;
(3)计算地址掩码;
(4)计算网络网络地址;
(5)计算网络广播地址;
(6)计算网络的[主机地址
4、总结常见网络管理命令
(1)ifconfig
(2)route
(3)ip
(4)nmcli
5、给定IP地址167.77.88.99和掩码255.255.255.192,子网号是什么?广播地址是什么?有效IP地址是什么?
子网号:167.77.88.64
广播地址:167.77.88.127
有效ip地址:167.77.88.65 ~ 167.77.88.126
6、添加IP地址192.168.2.2/24到eth0网卡上:
[root@centos6 ~]cd /etc/sysconfig/network-scripts/
[root@centos6 network-scripts]vim ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
UUID=c08dc3f6-c7e3-4571-a25f-4fd696f59b87
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
HWADDR=00:0C:29:78:4E:C6
NAME="System eth0"
IPADDR=192.168.2.2
prefix=24
[root@centos6 ~]service network restart
7、网络组的创建
1.centos 6配置bonding(activebackup模式)
[root@centos6 network-scripts]vim ifcfg-eth0
DEVICE=bond0
IPADDR=192.168.48.128
PREFIX=24
BONDING_OPTS="mode=0 miimon=100"
[root@centos6 network-scripts]vim ifcfg-eth0
DEVICE=eth0
MASTER=bond0
SLAVE=yes
[root@centos6 network-scripts]vim ifcfg-eth1
DEVICE=eth1
MASTER=bond0
SLAVE=yes
[root@centos6 network-scripts]service NetworkManager stop
[root@centos6 network-scripts]service network restart
2.centos 7配置bonding(activebackup模式)
[root@centos7 ~]nmcli con add type bond con-name bond0 ifname bond0 mode active-backup
[root@centos7 ~]nmcli con mod bond0 ipv4.method manual ipv4.address 192.168.48.129/24
[root@centos7 ~]nmcli con add type bond-slave ifname ens33 master bond0
[root@centos7 ~]nmcli con add type bond-slave ifname ens37 master bond0
[root@centos7 ~]nmcli con up bond-slave-ens33
[root@centos7 ~]nmcli con up bond-slave-ens37
[root@centos7 ~]nmcli con up bond0
[root@centos7 ~]systemctl restart network
3.centos 7以网络组的方式配置bonding(activebackup模式)
[root@centos7 ~]nmcli con add type team con-name team0 ifname team0 config '{"runner": {"name": "activebackup"}}'
[root@centos7 ~]nmcli con mod team0 ipv4.addresses 192.168.48.129/24 ipv4.method manual
[root@centos7 ~]nmcli con add con-name team0-ens33 type team-slave ifname ens33 master team0
[root@centos7 ~]nmcli con add con-name team0-ens37 type team-slave ifname ens37 master team0
[root@centos7 ~]nmcli con up team0
[root@centos7 ~]nmcli con up team0-eth1
[root@centos7 ~]nmcli con up team0-eth2
[root@centos7 ~]systemctl restart network
注意
1.在配置bonding时,所有网卡必须是物理存在的网卡,且物理上必须在同一网段,也就是说要么都桥接要么都仅主机
2.centos 6必须将NetworkManager停用,centos 7不是必须的
3.配置完后需要重启网卡