3.21 10.11-10.15听课笔记

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了3.21 10.11-10.15听课笔记相关的知识,希望对你有一定的参考价值。

Linux网络相关

 

[[email protected] ~]# ifconfig

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

        inet 192.168.91.128  netmask 255.255.255.0  broadcast 192.168.91.255

        inet6 fe80::613e:a8bf:a776:7dbb  prefixlen 64  scopeid 0x20<link>

        ether 00:0c:29:58:49:a9  txqueuelen 1000  (Ethernet)

        RX packets 105173  bytes 31378778 (29.9 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 279549  bytes 72836445 (69.4 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 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

[[email protected] ~]# ip addr

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    inet 127.0.0.1/8 scope host lo

       valid_lft forever preferred_lft forever

    inet6 ::1/128 scope host

       valid_lft forever preferred_lft forever

2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

    link/ether 00:0c:29:58:49:a9 brd ff:ff:ff:ff:ff:ff

    inet 192.168.91.128/24 brd 192.168.91.255 scope global ens33

       valid_lft forever preferred_lft forever

    inet6 fe80::613e:a8bf:a776:7dbb/64 scope link

       valid_lft forever preferred_lft forever

[[email protected] ~]# ifdown ens33

 

Connection closed by foreign host.

 

Disconnected from remote host(hyclinux-01) at 22:31:38.

 

Type `help' to learn how to use Xshell prompt.

执行后连接断开

[[email protected]lhost ~]# ifup ens33

*ifdownifup可以在修改指定网卡配置后重启指定的网卡

 

[[email protected] ~]# ifdown ens33 && ifup ens33

成功断开设备 'ens33'

连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/3

 

设置虚拟网卡

[[email protected] ~]#

在网卡配置文件目录下拷贝ifcfg-ens33文件,更名为ifcfg-ens330,做如下修改:

TYPE=Ethernet

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=static

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_FAILURE_FATAL=no

IPV6_ADDR_GEN_MODE=stable-privacy

NAME=ens33:0

UUID=32826281-32dd-4e88-af97-8176b8eb1eee

DEVICE=ens33:0

ONBOOT=yes

IPADDR=192.168.91.131

NETMASK=255.255.255.0

GATEWAY=192.168.91.2

 

[[email protected] ~]# ifconfig

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

        inet 192.168.91.128  netmask 255.255.255.0  broadcast 192.168.91.255

        inet6 fe80::613e:a8bf:a776:7dbb  prefixlen 64  scopeid 0x20<link>

        ether 00:0c:29:58:49:a9  txqueuelen 1000  (Ethernet)

        RX packets 107714  bytes 31619328 (30.1 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 281528  bytes 73182413 (69.7 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

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

        inet 192.168.91.131  netmask 255.255.255.0  broadcast 192.168.91.255

        ether 00:0c:29:58:49:a9  txqueuelen 1000  (Ethernet)

 

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 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

[[email protected] ~]# mii-tool ens33 两个命令均可查看网卡是否连接(网线)

ens33: negotiated 1000baseT-FD flow-control, link ok

[[email protected] ~]# ethtool ens33

Settings for ens33:

         Supported ports: [ TP ]

         Supported link modes:   10baseT/Half 10baseT/Full

                                 100baseT/Half 100baseT/Full

                                 1000baseT/Full

         Supported pause frame use: No

         Supports auto-negotiation: Yes

         Advertised link modes:  10baseT/Half 10baseT/Full

                                 100baseT/Half 100baseT/Full

                                 1000baseT/Full

         Advertised pause frame use: No

         Advertised auto-negotiation: Yes

         Speed: 1000Mb/s

         Duplex: Full

         Port: Twisted Pair

         PHYAD: 0

         Transceiver: internal

         Auto-negotiation: on

         MDI-X: off (auto)

         Supports Wake-on: d

         Wake-on: d

         Current message level: 0x00000007 (7)

                                 drv probe link

         Link detected: yes

 

问题:

[[email protected] ~]# cat /etc/resolv.conf

; generated by /usr/sbin/dhclient-script

search localdomain

nameserver 192.168.91.2

如果在这个文件里修改dns,重启机器后该文件的配置会被网卡配置文件中的dns覆盖

 

[[email protected] ~]# cat /etc/hosts 访问自定义域名时使用(自定义域名对应的ip

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

[[email protected] ~]# vim /etc/hosts

[[email protected] ~]# ping www.baidu.com

PING www.baidu.com (127.0.0.1) 56(84) bytes of data.

64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.070 ms

64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.085 ms

64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.085 ms

64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.069 ms

64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.074 ms

64 bytes from localhost (127.0.0.1): icmp_seq=6 ttl=64 time=0.067 ms

^Z

[1]+  已停止               ping www.baidu.com

[[email protected] ~]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

127.0.0.1   www.baidu.com

*可以支持一个ip对应多个域名

Hosts文件中一个域名配多个ip时以最后配置的对应关系为主


以上是关于3.21 10.11-10.15听课笔记的主要内容,如果未能解决你的问题,请参考以下文章

python 听课笔记- 序(鸡汤)

APIO2017听课笔记关键词

听课笔记

Daily dictation 听课笔记

Struts+Hibernate 听课笔记

3.12 听课笔记