概述

第一周作业:

1. 图文并茂解释开源许可证 GPL、BSD、MIT、Mozilla、Apache和LGPL的区别?

2. 安装centos ubuntu系统.

3. 通过计算机基础和帮助的学习,完成学习ifconfig命令的使用。

4. 总结linux FHS结构。

5. 简要描述后期学习的计划。

具体解答

一. 图文并茂解释开源许可证 GPL、BSD、MIT、Mozilla、Apache和LGPL的区别?

开源许可证有多种,现在来说说最流行的六种:GPL、BSD、MIT、Mozilla、Apache和LGPL。

示意图:

Homework week01_linux


1.LGPL许可证(GNU LGPL | Open Source Initiative)

LGPL 允许以动态链接使用开源库。采用LGPL的代码,一般情况下它本身就是一个第三方库(LGPL最早的名字就是Library GPL),这时候开发人员仅仅用到了它的功能,而没有对库本身进行任何修改,那么开发人员也不必公布自己的商业源代码。但是如果修改LGPL协议的代码或者衍生,则所有修改的代码,涉及修改部分的额外代码和衍生的代码都必须开源,并且采用LGPL协议。

2.Mozilla许可证(Internet for people, not profit — Mozilla)

Mozilla公共许可证(英语:Mozilla Public License,简称MPL)  允许免费重发布、免费修改,但要求修改后的代码版权归软件的发起者。要求所有再发布者都得有一个专门的文件就对源代码程序修改的时间和修改的方式有描述。允许一个企业在自己已有的源代码库上加一个接口,除了接口程序的源代码以MPL 许可证的形式对外许可外,源代码库中的源代码就可以不用MPL许可证的方式强制对外许可。

3.GPL许可证(How to use GNU licenses for your own software- GNU Project - Free Software Foundation)

1980年,美国人Richard Stallman,而建立了GPL许可证。他认为,软件的源代码是全人类的财富,应该允许程序员自由共享。GPL许可证的核心含义是:允许任何人观看、修改,并散播程序软件里的原始程序码,条件是如果你要发布修改后的版本就要连源代码一起公布,不允许修改后和衍生的代码做为闭源的商业软件发布和销售。Linux就是采用了GPL协议,这也就是为什么我们能用免费的各种linux,包括商业公司的linux和linux上各种各样的由个人,组织,以及商业软件公司开发的免费软件了。GPL协议的主要内容是只要在一个软件中使用(”使用”指类库引用,修改后的代码或者衍生代码)GPL 协议的产品,则该软件产品必须也采用GPL协议,即必须也是开源和免费。这就是所谓的”传染性”。GPL协议的产品作为一个单独的产品使用没有任何问题,还可以享受免费的优势。由于GPL严格要求使用了GPL类库的软件产品必须使用GPL协议,对于使用GPL协议的开源代码,商业软件或者对代码有保密要求的部门就不适合集成/采用作为类库和二次开发的基础。

4.BSD许可证(https://en.wikipedia.org/wiki/BSD_licenses)

BSD开源协议是一个给于使用者很大自由的协议。基本上使用者可以”为所欲为”,可以自由的使用,修改源代码,也可以将修改后的代码作为开源或者专有软件再发布。但”为所欲为”的前提当你发布使用了BSD协议的代码,或则以BSD协议代码为基础做二次开发自己的产品时,需要满足三个条件:

a.如果再发布的产品中包含源代码,则在源代码中必须带有原来代码中的BSD协议。 

b.如果再发布的只是二进制类库/软件,则需要在类库/软件的文档和版权声明中包含原来代码中的BSD协议。

c.不可以用开源代码的作者、机构名字和原来产品的名字做市场推广。BSD 代码鼓励代码共享,但需要尊重代码作者的著作权。

BSD由于允许使用者修改和重新发布代码,也允许使用或在BSD代码上开发商业软件发布和销售,因此是对商业集成很友好的协议。而很多的公司企业在选用开源产品的时候都首选BSD协议,因为可以完全控制这些第三方的代码,在必要的时候可以修改或者二次开发。

5.MIT许可证(The MIT License | Open Source Initiative)

MIT是和BSD一样宽范的许可协议。你必须在你的发行版里包含原许可协议的声明,无论你是以二进制发布的还是以源代码发布的。作者只想保留版权,而无任何其他了限制,较BSD协议宽松。

一般使用 MIT 授权的项目,需在源文件头部增加以下内容:

Copyright [yyyy] [name of copyright owner]. All rights reserved.

//[yyyy] 表示该源文件创建的年份。紧随其后的是 [name of copyright owner],即版权所有者。如果为个人项目,就写个人名称;若为团队项目,则宜写团队名称。

6.Apache许可证(http://www.apache.org/licenses/LICENSE-2.0)

Apache Licence是著名的非盈利开源组织Apache采用的协议。该协议和BSD类似,同样鼓励代码共享和尊重原作者的著作权,同样允许代码修改,再发布(作为开源或商业软件)。需要满足的条件也和BSD类似:

   需要给代码的用户一份Apache Licence;如果你修改了代码,需要再被修改的文件中说明。在延伸的代码中(修改和有源代码衍生的代码中)需要带有原来代码中的协议,商标,专利声明和其他原来作者规定需要包含的说明。

   如果再发布的产品中包含一个Notice文件,则在Notice文件中需要带有Apache Licence。你可以在Notice中增加自己的许可,但不可以表现为对Apache Licence构成更改。

Apache Licence也是对商业应用友好的许可。使用者也可以在需要的时候修改代码来满足需要并作为开源或商业产品发布/销售。

该许可证要求在所有的源文件中的头部放置以下内容才能算协议对该文件有效:

Copyright [yyyy] [name of copyright owner]

//[yyyy] 表示该源文件创建的年份。紧随其后的是 [name of copyright owner],即版权所有者。如果为个人项目,就写个人名称;若为团队项目,则宜写团队名称。

严格程度:MIT->BSD->Apache->LGPL->Mozilla->GPL


二. 安装centos、 ubuntu系统.

安装前置操作

打开 VMware Workstation

编辑 ----> 虚拟网络编辑器

修改网络配置

Homework week01_apache_02

Homework week01_商业_03

Homework week01_apache_04

Homework week01_linux_05

A.Centos(Rocky8. 6)系统安装

打开 VMware Workstation

1. 点击左上角 ”文件“,在下拉中选择第一项 “新建虚拟机”;
2. 选择 “自定义(高级)C”,然后点击 “下一步”;
3. "硬件兼容性(H)" 使用默认值,点击 “下一步”;
4. 选择 “稍后安装操作系统(S)”,点击 “下一步”;
5. “客户机操作系统”,选择第二项 “Linux”,版本选择 “CentOS 8 64位”,点 击 “下一步”;
6. “虚拟机名称” 填写 “Rocky8.5”,“位置” 不用更改,点击 “下一步”;
7. “处理器数量” 下拉,选择 “2”,其它项不变,点击 “下一步“;
8. ”此虚拟机内存(M)“,填写 “2048” MB,点击 “下一步”;
9. “网络类型” 选择第二项 “使用网络地址转换(NAT)(E)”,点击 “下一步”;
10. “SCSI控制器” 选择第二项 “LSI Logic(L) ”,点击 “下一步”;
11. “虚拟磁盘类型” 选择第二项 “SCSI(S)”,点击 “下一步”;
12. “磁盘” 选择第一项 “创建新虚拟磁盘”,点击 “下一步”;
13. “最大磁盘大小 (GB)(S): ” 填写 “200”,不要勾选 “立即分配所有磁盘空间(A)”,下方选择 “将虚拟机磁盘存储为单个文件(O)”,点击 “下一步”;
14. “磁盘文件”,文件名用默认 "Rocky8.5.vmdk",点击 “下一步”;
15. 点击 “完成”;

 在左侧菜单栏中,定位到刚新建的虚拟机,右键,设置 ,选择镜像(Rocky8. 6)(按视频操作创建Rocky8.5虚拟机,实际使用的是8.6的镜像包)

Homework week01_apache_06

开始安装

Homework week01_linux_07


Homework week01_apache_08


Homework week01_apache_09

选择英语;选择磁盘分区

时区选择 Shanghai

开启网络,设置主机名 rocky86

设置root用户密码 XXXXXX

创建一个普通用户,用户名 qin 密码 XXXXXX


Homework week01_linux_10

Homework week01_商业_11

等待结束,完成,重启。

Homework week01_商业_12

同意许可

Homework week01_linux_13

完成安装,显示登录界面

Homework week01_apache_14

B Ubuntu22.04安装过程

打开 VMware Workstation

1. 点击左上角 ”文件“,在下拉中选择第一项 “新建虚拟机”;
2. 选择 “自定义(高级)C”,然后点击 “下一步”;
3. "硬件兼容性(H)" 使用默认值,点击 “下一步”;
4. 选择 “稍后安装操作系统(S)”,点击 “下一步”;
5. “客户机操作系统”,选择第二项 “Linux”,Ubuntu 64 位”,点击 “下一步”;
6. “虚拟机名称” 填写 “Ubuntu22.04”,“位置” 不用更改,点击 “下一步”;
7. “处理器数量” 下拉,选择 “2”,其它项不变,点击 “下一步“;
8. ”此虚拟机内存(M)“,填写 “2048” MB,点击 “下一步”;
9. “网络类型” 选择第二项 “使用网络地址转换(NAT)(E)”,点击 “下一步”;
10. “SCSI控制器” 选择第二项 “LSI Logic(L) ”,点击 “下一步”;
11. “虚拟磁盘类型” 选择第二项 “SCSI(S)”,点击 “下一步”;
12. “磁盘” 选择第一项 “创建新虚拟磁盘”,点击 “下一步”;
13. “最大磁盘大小 (GB)(S): ” 填写 “200”,不要勾选 “立即分配所有磁盘空间(A)”,下方选择 “将虚拟机磁盘存储为单个文件(O)”,点击 “下一步”;
14. “磁盘文件”,文件名用默认 "Ubuntu22.04.3-2vmdk",点击 “下一步”;
15. 点击 “完成”;

在左侧菜单栏中,定位到刚新建的虚拟机,右键,设置 ,选择镜像(Ubuntu22.04.3)(操作创建Ubuntu22.04.3虚拟机,实际使用的是Ubuntu22.04.4的镜像包)

Homework week01_linux_15

Homework week01_apache_16

开始安装

Homework week01_商业_17

选择英语

Homework week01_apache_18

继续

Homework week01_linux_19

Homework week01_商业_20

Homework week01_商业_21

Homework week01_商业_22

Homework week01_商业_23

选择国内源,加速安装过程

例如:阿里云:​​http://mirrors.aliyun.com/ubuntu​

Homework week01_linux_24

Homework week01_商业_25

Homework week01_商业_26

Homework week01_商业_27

用户名:qht

主机名:ubuntu2004

呢称:qht

登录密码:XXXXXX

确认密码:XXXXXX


选择安装 openssh server

(Tab,空格键选择)

Homework week01_apache_28

开始安装

Homework week01_linux_29

完成,重启。

Homework week01_商业_30

登录界面

Homework week01_linux_31

三. 通过计算机基础和帮助的学习,完成学习ifconfig命令的使用

实际操作:

虚拟机中rocky8.6中查询“ifconfig”命令及参数
[root@rocky8 ~]# whatis ifconfig
ifconfig (8) - configure a network interface
[root@rocky8 ~]# ifconfig -help
Usage:
ifconfig [-a] [-v] [-s] <interface> [[<AF>] <address>]
[add <address>[/<prefixlen>]]
[del <address>[/<prefixlen>]]
[[-]broadcast [<address>]] [[-]pointopoint [<address>]]
[netmask <address>] [dstaddr <address>] [tunnel <address>]
[outfill <NN>] [keepalive <NN>]
[hw <HW> <address>] [mtu <NN>]
[[-]trailers] [[-]arp] [[-]allmulti]
[multicast] [[-]promisc]
[mem_start <NN>] [io_addr <NN>] [irq <NN>] [media <type>]
[txqueuelen <NN>]
[[-]dynamic]
[up|down] ...

<HW>=Hardware Type.
List of possible hardware types:
loop (Local Loopback) slip (Serial Line IP) cslip (VJ Serial Line IP)
slip6 (6-bit Serial Line IP) cslip6 (VJ 6-bit Serial Line IP) adaptive (Adaptive Serial Line IP)
ash (Ash) ether (Ethernet) ax25 (AMPR AX.25)
netrom (AMPR NET/ROM) rose (AMPR ROSE) tunnel (IPIP Tunnel)
ppp (Point-to-Point Protocol) hdlc ((Cisco)-HDLC) lapb (LAPB)
arcnet (ARCnet) dlci (Frame Relay DLCI) frad (Frame Relay Access Device)
sit (IPv6-in-IPv4) fddi (Fiber Distributed Data Interface) hippi (HIPPI)
irda (IrLAP) x25 (generic X.25) infiniband (InfiniBand)
eui64 (Generic EUI-64)
<AF>=Address family. Default: inet
List of possible address families:
unix (UNIX Domain) inet (DARPA Internet) inet6 (IPv6)
ax25 (AMPR AX.25) netrom (AMPR NET/ROM) rose (AMPR ROSE)
ipx (Novell IPX) ddp (Appletalk DDP) ash (Ash)
x25 (CCITT X.25)
[root@rocky8 ~]#man ifconfig


IFCONFIG(8) Linux System Administrator's Manual IFCONFIG(8)

NAME
ifconfig - configure a network interface

SYNOPSIS
ifconfig [-v] [-a] [-s] [interface]
ifconfig [-v] interface [aftype] options | address ...

NOTE
This program is obsolete! For replacement check ip addr and ip link. For statistics use ip -s link.

DESCRIPTION
Ifconfig is used to configure the kernel-resident network interfaces. It is used at boot time to set up interfaces as necessary. After that, it is usually only needed when
debugging or when system tuning is needed.

If no arguments are given, ifconfig displays the status of the currently active interfaces. If a single interface argument is given, it displays the status of the given inter‐
face only; if a single -a argument is given, it displays the status of all interfaces, even those that are down. Otherwise, it configures an interface.

Address Families
If the first argument after the interface name is recognized as the name of a supported address family, that address family is used for decoding and displaying all protocol
addresses. Currently supported address families include inet (TCP/IP, default), inet6 (IPv6), ax25 (AMPR Packet Radio), ddp (Appletalk Phase 2), ipx (Novell IPX) and netrom
(AMPR Packet radio). All numbers supplied as parts in IPv4 dotted decimal notation may be decimal, octal, or hexadecimal, as specified in the ISO C standard (that is, a lead‐
ing 0x or 0X implies hexadecimal; otherwise, a leading '0' implies octal; otherwise, the number is interpreted as decimal). Use of hexadecimal and octal numbers is not RFC-com‐
pliant and therefore its use is discouraged.

OPTIONS
-a display all interfaces which are currently available, even if down

-s display a short list (like netstat -i)

-v be more verbose for some error conditions

interface
The name of the interface. This is usually a driver name followed by a unit number, for example eth0 for the first Ethernet interface. If your kernel supports alias
interfaces, you can specify them with syntax like eth0:0 for the first alias of eth0. You can use them to assign more addresses. To delete an alias interface use ifcon‐
fig eth0:0 down. Note: for every scope (i.e. same net with address/netmask combination) all aliases are deleted, if you delete the first (primary).

up This flag causes the interface to be activated. It is implicitly specified if an address is assigned to the interface; you can suppress this behavior when using an
alias interface by appending an - to the alias (e.g. eth0:0-). It is also suppressed when using the IPv4 0.0.0.0 address as the kernel will use this to implicitly
delete alias interfaces.

down This flag causes the driver for this interface to be shut down.

[-]arp Enable or disable the use of the ARP protocol on this interface.

[-]promisc
Enable or disable the promiscuous mode of the interface. If selected, all packets on the network will be received by the interface.

[-]allmulti
Enable or disable all-multicast mode. If selected, all multicast packets on the network will be received by the interface.

mtu N This parameter sets the Maximum Transfer Unit (MTU) of an interface.

dstaddr addr
Set the remote IP address for a point-to-point link (such as PPP). This keyword is now obsolete; use the pointopoint keyword instead.

netmask addr
Set the IP network mask for this interface. This value defaults to the usual class A, B or C network mask (as derived from the interface IP address), but it can be set
to any value.

add addr/prefixlen
Add an IPv6 address to an interface.

del addr/prefixlen
Remove an IPv6 address from an interface.

tunnel ::aa.bb.cc.dd
Create a new SIT (IPv6-in-IPv4) device, tunnelling to the given destination.

irq addr
Set the interrupt line used by this device. Not all devices can dynamically change their IRQ setting.

io_addr addr
Set the start address in I/O space for this device.

mem_start addr
Set the start address for shared memory used by this device. Only a few devices need this.

media type
Set the physical port or medium type to be used by the device. Not all devices can change this setting, and those that can vary in what values they support. Typical
values for type are 10base2 (thin Ethernet), 10baseT (twisted-pair 10Mbps Ethernet), AUI (external transceiver) and so on. The special medium type of auto can be used
to tell the driver to auto-sense the media. Again, not all drivers can do this.

[-]broadcast [addr]
If the address argument is given, set the protocol broadcast address for this interface. Otherwise, set (or clear) the IFF_BROADCAST flag for the interface.

[-]pointopoint [addr]
This keyword enables the point-to-point mode of an interface, meaning that it is a direct link between two machines with nobody else listening on it.
If the address argument is also given, set the protocol address of the other side of the link, just like the obsolete dstaddr keyword does. Otherwise, set or clear the
IFF_POINTOPOINT flag for the interface.

hw class address
Set the hardware address of this interface, if the device driver supports this operation. The keyword must be followed by the name of the hardware class and the print‐
able ASCII equivalent of the hardware address. Hardware classes currently supported include ether (Ethernet), ax25 (AMPR AX.25), ARCnet and netrom (AMPR NET/ROM).

multicast
Set the multicast flag on the interface. This should not normally be needed as the drivers set the flag correctly themselves.

address
The IP address to be assigned to this interface.

txqueuelen length
Set the length of the transmit queue of the device. It is useful to set this to small values for slower devices with a high latency (modem links, ISDN) to prevent fast
bulk transfers from disturbing interactive traffic like telnet too much.

NOTES
Since kernel release 2.2 there are no explicit interface statistics for alias interfaces anymore. The statistics printed for the original address are shared with all alias
addresses on the same device. If you want per-address statistics you should add explicit accounting rules for the address using the iptables(8) command.

Since net-tools 1.60-4 ifconfig is printing byte counters and human readable counters with IEC 60027-2 units. So 1 KiB are 2^10 byte. Note, the numbers are truncated to one
decimal (which can by quite a large error if you consider 0.1 PiB is 112.589.990.684.262 bytes :)

Interrupt problems with Ethernet device drivers fail with EAGAIN (SIOCSIIFLAGS: Resource temporarily unavailable) it is most likely a interrupt conflict. See
http://www.scyld.com/expert/irq-conflict.html for more information.

FILES
/proc/net/dev
/proc/net/if_inet6

BUGS
Ifconfig uses the ioctl access method to get the full address information, which limits hardware addresses to 8 bytes. Because Infiniband hardware address has 20 bytes, only
the first 8 bytes are displayed correctly. Please use ip link command from iproute2 package to display link layer informations including the hardware address.

While appletalk DDP and IPX addresses will be displayed they cannot be altered by this command.

SEE ALSO
ip(8), iptables(8)
http://physics.nist.gov/cuu/Units/binary.html - Prefixes for binary multiples

AUTHORS
Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
Alan Cox, <Alan.Cox@linux.org>
Phil Blundell, <Philip.Blundell@pobox.com>
Andi Kleen
Bernd Eckenfels, <net-tools@lina.inka.de>

虚拟机中ubuntu2004中查询“ifconfig”命令及参数
root@ubuntu2004:~# ifoncofig -help
ifoncofig: command not found
root@ubuntu2004:~# ifconfig

Command 'ifconfig' not found, but can be installed with:

apt install net-tools

root@ubuntu2004:~# apt install net-tools
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
net-tools
0 upgraded, 1 newly installed, 0 to remove and 45 not upgraded.
Need to get 196 kB of archives.
After this operation, 864 kB of additional disk space will be used.
Get:1 http://mirrors.aliyun.com/ubuntu focal/main amd64 net-tools amd64 1.60+git20180626.aebd88e-1ubuntu1 [196 kB]
Fetched 196 kB in 0s (1,015 kB/s)
Selecting previously unselected package net-tools.
(Reading database ... 72115 files and directories currently installed.)
Preparing to unpack .../net-tools_1.60+git20180626.aebd88e-1ubuntu1_amd64.deb ...
Unpacking net-tools (1.60+git20180626.aebd88e-1ubuntu1) ...
Setting up net-tools (1.60+git20180626.aebd88e-1ubuntu1) ...
Processing triggers for man-db (2.9.1-1) ...
root@ubuntu2004:~# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.130 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::20c:29ff:fe84:6d9d prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:84:6d:9d txqueuelen 1000 (Ethernet)
RX packets 1544 bytes 1086449 (1.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 771 bytes 72471 (72.4 KB)
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 1000 (Local Loopback)
RX packets 98 bytes 7885 (7.8 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 98 bytes 7885 (7.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

root@ubuntu2004:~#

ifconfig网络参数及用法

    用ifconfig命令配置的网卡信息,在网卡重启后机器重启后,配置就不存在。要想将上述的配置信息永远的存的电脑里,那就要修改网卡的配置文件了。

语法

ifconfig(参数)

参数

add<地址>:设置网络设备IPv6的ip地址;
del<地址>:删除网络设备IPv6的IP地址;
down:关闭指定的网络设备;
<硬件地址>:设置网络设备的类型与硬件地址;
io_addr:设置网络设备的I/O地址;
irq:设置网络设备的IRQ;
media<网络媒介类型>:设置网络设备的媒介类型;
mem_start<内存地址>:设置网络设备在主内存所占用的起始地址;
metric<数目>:指定在计算数据包的转送次数时,所要加上的数目;
mtu<字节>:设置网络设备的MTU;
netmask<子网掩码>:设置网络设备的子网掩码;
tunnel<地址>:建立IPv4与IPv6之间的隧道通信地址;
up:启动指定的网络设备;
-broadcast<地址>:将要送往指定地址的数据包当成广播数据包来处理;
-pointopoint<地址>:与指定地址的网络设备建立直接连线,此模式具有保密功能;
-promisc:关闭或启动指定网络设备的promiscuous模式;
IP地址:指定网络设备的IP地址;
网络设备:指定网络设备的名称

实例

[root@rocky8 ~]# ifconfig
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.128 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::20c:29ff:fe90:3398 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:90:33:98 txqueuelen 1000 (Ethernet)
RX packets 2069 bytes 208772 (203.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1032 bytes 164414 (160.5 KiB)
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 1000 (Local Loopback)
RX packets 88 bytes 7432 (7.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 88 bytes 7432 (7.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:f3:80:16 txqueuelen 1000 (Ethernet)
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


显示网络设备信息(激活状态的):

说明:

ens160表示第一块网卡,其中HWaddr表示网卡的物理地址,可以看到目前这个网卡的物理地址(MAC地址)是00:0c:29:90:33:98。
inet addr用来表示网卡的IP地址,此网卡的IP地址是10.0.0.128,广播地址Bcast:10.0.0.255,掩码地址Mask:255.255.255.0。
lo是表示主机的回环地址,这个一般是用来测试一个网络程序,但又不想让局域网或外网的用户能够查看,只能在此台主机上运行和查看所用的网络接口。比如把 httpd服务器的指定到回环地址,在浏览器输入127.0.0.1就能看到你所架WEB网站了。但只是您能看得到,局域网的其它主机或用户无从知道。
第一行:连接类型:Ethernet(以太网)HWaddr(硬件mac地址)。
第二行:网卡的IP地址、子网、掩码。
第三行:UP(代表网卡开启状态)RUNNING(代表网卡的网线被接上)MULTICAST(支持组播)MTU:1500(最大传输单元):1500字节。
第四、五行:接收、发送数据包情况统计。
第七行:接收、发送数据字节数统计信息。

启动关闭指定网卡:

ifconfig ens160 up

ifconfig ens160 down

ifconfig ens160 up为启动网卡ens160,ifconfig ens160 down为关闭网卡ens160。
ssh登陆linux服务器操作要小心,关闭了就不能开启了,除非你有多网卡。
为网卡配置和删除IPv6地址:

ifconfig ens160 add 33ffe:3240:800:1005::2/64 #为网卡ens160配置IPv6地址

ifconfig ens160 del 33ffe:3240:800:1005::2/64 #为网卡ens160删除IPv6地址

用ifconfig修改MAC地址:

ifconfig ens160 hw ether 00:AA:BB:CC:dd:EE

配置IP地址:

[root@rocky8 ~]# ifconfig ens160 192.168.2.10

[root@rocky8 ~]# ifconfig ens160 192.168.2.10 netmask 255.255.255.0

[root@rocky8 ~]# ifconfig ens160 192.168.2.10 netmask 255.255.255.0 broadcast 192.168.2.255

启用和关闭arp协议:

ifconfig ens160arp #开启网卡eth0 的arp协议

ifconfig ens160 -arp #关闭网卡eth0 的arp协议

设置最大传输单元:

ifconfig ens160 mtu 1500 #设置能通过的最大数据包大小为 1500 bytes

四. 总结linux FHS结构

linux的文件系统分层结构FileSystem Hierarchy Standdard(简称FHS)。

      定义了在Linux系统中的目录结构和目录内容,即让用户了解到已安装软件通常放置哪个目录下。类似于Windows操作系统中C盘的文件目录,FHS采用树形结构组织文件,定义了系统中每个区域的用途、所需要的最小构成的文件和目录,同时还给出了例外处理和矛盾处理。

文件系统目录结构:

Homework week01_apache_32

FHS的重点在于规范每个特定的目录下应该要放置什么样的数据,针对目录树架构仅定义3层目录:

(1)/目录:--root
(2)/usr目录:--Uninx Software Resource
(3)/var目录:--Variable data files

常见文件系统的目录功能:

/boot:存放内核文件(vmlinuz)、引导加载器(bootloader, grub)等引导文件都存放于此目录
/bin :所有用户使用的基本命令, OS 启动即会用到的程序
/sbin :管理类的基本命令, OS 启动即会用到的程序
/lib :启动时程序依赖的基本共享库文件,以及内核模块文件 (/lib/modules)
/lib64 :专用于 x86_64 系统上的辅助共享库文件存放位置
/etc :配置文件目录
/home/USERNAME :普通用户家目录
/root :管理员的家目录
/media :便携式移动设备挂载点
/mnt :临时文件系统挂载点
/dev :设备文件及特殊文件存储位置 b: block device 随机访问;c: character device ,线性访问
/opt :第三方应用程序的安装位置
/tmp :临时文件存储位置


五. 简要描述后期学习的计划

学习计划:

1、快速看完1-2遍视频课程及配套的文档;

2、重点操作练习每节课程中的知识点;做好学习笔记,特别是实际操作中的   错误点及工作中常用的技术点,形成自己的知识库。

3、归纳总结重点知识点形成自己的知识体系,关注面试考点;