免费观看又色又爽又黄的小说免费_美女福利视频国产片_亚洲欧美精品_美国一级大黄大色毛片

四、confignetwork-創新互聯

1、學習rhel7中新的網絡配置工具和網卡命名規則

成都創新互聯公司-專業網站定制、快速模板網站建設、高性價比雙陽網站開發、企業建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式雙陽網站制作公司更省心,省錢,快速模板網站建設找我們,業務覆蓋雙陽地區。費用合理售后完善,十載實體公司更值得信賴。

下面這段文字參考紅帽官網網絡配置第8章2節,在rhel7/centos7中網卡的命名規則有些改變,增加了nmcli網絡管理工具。

1、A rule in /usr/lib/udev/rules.d/60-net.rules instructs the udev helper utility, /lib/udev/rename_device, to look into all /etc/sysconfig/network-scripts/ifcfg-suffix files. If it finds an ifcfg file with a HWADDR entry matching the MAC address of an interface it renames the interface to the name given in the ifcfg file by the DEVICE directive.
2、A rule in /usr/lib/udev/rules.d/71-biosdevname.rules instructs biosdevname to rename the interface according to its naming policy, provided that it was not renamed in a previous step, biosdevname is installed, and biosdevname=0 was not given as a kernel command on the boot command line.

3、A rule in /lib/udev/rules.d/75-net-description.rules instructs udev to fill in the internal udev device property values ID_NET_NAME_ONBOARD, ID_NET_NAME_SLOT, ID_NET_NAME_PATH, ID_NET_NAME_MAC by examining the network interface device. Note, that some device properties might be undefined.

4、A rule in /usr/lib/udev/rules.d/80-net-name-slot.rules instructs udev to rename the interface, provided that it was not renamed in step 1 or 2, and the kernel parameter net.ifnames=0 was not given, according to the following priority: ID_NET_NAME_ONBOARD, ID_NET_NAME_SLOT, ID_NET_NAME_PATH. It falls through to the next in the list, if one is unset. If none of these are set, then the interface will not be renamed.

2、配置網卡使用rhel6版本的網卡配置方式:

[root@station66 ~]# cat /etc/udev/rules.d/70-persistent-net.rules

# This file was automatically generated by the /lib/udev/write_net_rules

# program, run by the persistent-net-generator.rules rules file.

#

# You can modify it, as long as you keep each rule on a single

# line, and change only the value of the NAME= key.

# PCI device 0x8086:0x100f (e1000)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:36:87:62", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

[root@station71 ~]# cat /etc/udev/rules.d/70-persistent-ipoib.rules

# This is a sample udev rules file that demonstrates how to get udev to

# set the name of IPoIB interfaces to whatever you wish.  There is a

# 16 character limit on network device names though, so don't go too nuts

#

# Important items to note: ATTR{type}=="32" is IPoIB interfaces, and the

# ATTR{address} match must start with ?* and only reference the last 8

# bytes of the address or else the address might not match on any given

# start of the IPoIB stack

#

# Note: as of rhel7, udev is case sensitive on the address field match

# and all addresses need to be in lower case.

#

# ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{type}=="32", ATTR{address}=="?*00:02:c9:03:00:31:78:f2", NAME="mlx4_ib3

  • 編輯網卡配置文件ifcfg-eno16777736修改為ifcfg-eth0,修改DEVICE,NAME,HWADDR,NM_CONTROLLED等參數.

  • 禁用ipv6和biosdevname功能,傳遞這2個參數給kernel:net.ifnames=0 ipv6.disable=1,重新生成grub.cfg配置文件即可

我們來具體操作一把:

[root@station71 network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 #這塊叫啥沒有關系的哈!

TYPE=Ethernet

HWADDR=00:0c:29:95:b5:21

BOOTPROTO=none

NAME=eth0

DEVICE=eth0

ONBOOT=yes

IPADDR=192.168.99.71

PREFIX=24

GATEWAY=192.168.99.1

DNS1=202.106.46.151

[root@station71 ~]#vim  /etc/default/grub  +6  #給內核傳遞參數關閉biosdevname功能關閉ipv6.

GRUB_CMDLINE_LINUX="net.ifnames=0 ipv6.disable=1 rd.lvm.lv=rootvg/root rd.lvm.lv=rootvg/swap rhgb quiet"

[root@station71 ~]# grub2-mkconfig   /boot/grub2/grub.cfg

現在重啟看到我們的網卡應該是eth0了、如果改個網卡的名字都需要重啟,那還搞毛線,事實上是uptime在幾千的很常見。

[root@station71 network-scripts]# ifconfig  eno16777736  down

[root@station71 network-scripts]# ethtool-i  eno16777736   #網卡的驅動名字

driver: e1000

[root@station71 network-scripts]# modinfo  e1000      #網卡的驅動程序所在的模塊

filename:    /lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/net/ethernet/intel/e1000/e1000.ko

[root@station71 network-scripts]# modprobe  -r  e1000     #卸載網卡驅動模塊

[root@station71 network-scripts]# lsmod|grep  e1000   #查看一下

[root@station71 network-scripts]# modprobee1000      #重新加載網卡驅動

3、nmcli工具使用及NetworkManager服務

需求1:

配置倆個虛擬機網絡,一個橋接到物理網絡的無線路由器,一個選擇自定義網絡配置一個192.168.99.0的網段,編輯虛擬機配置2張網卡。eno16777736用于橋接和eno33554984用于虛擬機私有網絡

1、給eno16777736配置三個connection,其中兩個dhcp自動獲取,另外一個需手動配置ip地址信息192.168.100.77/24和gateway配置192.168.100.1域名解析地址配置為202.106.46.151

2、給eno33554984配置一個connection,需手動配置一個ip地址信息

工作一個號,家庭一個號,兩不耽誤!

[root@station71 ~]# nmcli  device

DEVICE    TYPE    STATE     CONNECTION

virbr0    bridge   connected   virbr0

eno50332208  ethernet  connected   eth3

eno16777736  ethernet  disconnected  --

eno33554984  ethernet  disconnected  --

lo      loopback  unmanaged   --

virbr0-nic  tap    unmanaged   --

[root@station71 ~]# nmcli connection add type ethernet ifname eno16777736  con-name eth0

Connection 'eth0' (3d0ea27f-aee7-4598-9c23-679fde3de18f) successfully added.

[root@station71 ~]# nmcli connection add type ethernet ifname eno16777736  con-name eth0.home

Connection 'eth0.home' (54ef6f15-7981-4f0d-9958-15d6adabb05c) successfully added.

[root@station71 ~]# nmcli connection add type ethernet ifname eno16777736  con-name eth0.work

Connection 'eth0.work' (07d80f13-d36d-43f0-9b07-0648dd91e164) successfully added.

[root@station71 ~]# nmcli connection modify eth0 ipv4.method manual ipv4.addresses 192.168.100.71/24 ipv4.gateway 192.168.100.1 ipv4.dns 202.106.46.151

[root@station71 ~]# nmcli connection modify eth0.home ipv4.method auto ipv4.dns 202.106.46.151

[root@station71 ~]# nmcli connection modify eth0.work ipv4.method auto ipv4.dns 202.106.195.68

[root@station71 ~]# nmcli connection add type ethernet ifname eno33554984  con-name eth2

Connection 'eth2' (8a97025f-4581-410f-80bd-31b5759970de) successfully added.

[root@station71 ~]# nmcli connection modify eth2 ipv4.method manual ipv4.addresses 192.168.99.71/24 ipv4.gateway 192.168.99.1

[root@station71 ~]# nmcli connection up eth0 ; nmcli  connection  up eth2

Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/31)

Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/32)

[root@station71 ~]# nmcli device

DEVICE    TYPE    STATE    CONNECTION

virbr0    bridge   connected  virbr0

eno16777736  ethernet  connected  eth0

eno33554984  ethernet  connected  eth2

eno50332208  ethernet  connected  eth3

lo      loopback  unmanaged  --

virbr0-nic  tap    unmanaged  --

[root@station71 ~]# nmcli connection show

NAME    UUID                  TYPE       DEVICE

virbr0   0d0064a4-b64e-44de-82c7-5f4eb991f1bd  bridge      virbr0

eth2    8a97025f-4581-410f-80bd-31b5759970de  802-3-ethernet  eno33554984

eth0.work  07d80f13-d36d-43f0-9b07-0648dd91e164  802-3-ethernet  --

eth0.home  54ef6f15-7981-4f0d-9958-15d6adabb05c  802-3-ethernet  --

eth0    3d0ea27f-aee7-4598-9c23-679fde3de18f  802-3-ethernet  eno16777736

eth3    919158d0-ecfc-468a-aa99-85891161a972  802-3-ethernet  eno50332208

[root@station71 ~]# nmcli connection show  --active

NAME   UUID                  TYPE       DEVICE

virbr0  0d0064a4-b64e-44de-82c7-5f4eb991f1bd  bridge      virbr0

eth2   8a97025f-4581-410f-80bd-31b5759970de  802-3-ethernet  eno33554984

eth0   3d0ea27f-aee7-4598-9c23-679fde3de18f  802-3-ethernet  eno16777736

eth3   919158d0-ecfc-468a-aa99-85891161a972  802-3-ethernet  eno50332208

[root@station71 ~]# ping  www.baidu.com

PING www.a.shifen.com (61.135.169.125) 56(84) bytes of data.

64 bytes from 61.135.169.125: icmp_seq=1 ttl=57 time=6.31 ms

^C

--- www.a.shifen.com ping statistics ---

另外有需要云服務器可以了解下創新互聯scvps.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業上云的綜合解決方案,具有“安全穩定、簡單易用、服務可用性高、性價比高”等特點與優勢,專為企業上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

名稱欄目:四、confignetwork-創新互聯
文章網址:http://m.newbst.com/article0/coeeio.html

成都網站建設公司_創新互聯,為您提供小程序開發App開發品牌網站建設云服務器ChatGPT面包屑導航

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

成都網頁設計公司