【移動(dòng)應(yīng)用開(kāi)發(fā)技術(shù)】四、config network_第1頁(yè)
【移動(dòng)應(yīng)用開(kāi)發(fā)技術(shù)】四、config network_第2頁(yè)
【移動(dòng)應(yīng)用開(kāi)發(fā)技術(shù)】四、config network_第3頁(yè)
【移動(dòng)應(yīng)用開(kāi)發(fā)技術(shù)】四、config network_第4頁(yè)
【移動(dòng)應(yīng)用開(kāi)發(fā)技術(shù)】四、config network_第5頁(yè)
免費(fèi)預(yù)覽已結(jié)束,剩余1頁(yè)可下載查看

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

【移動(dòng)應(yīng)用開(kāi)發(fā)技術(shù)】四、confignetwork

1、學(xué)習(xí)rhel7中新的網(wǎng)絡(luò)配置工具和網(wǎng)卡命名規(guī)則下面這段文字參考紅帽官網(wǎng)網(wǎng)絡(luò)配置第8章2節(jié),在rhel7/centos7中網(wǎng)卡的命名規(guī)則有些改變,增加了nmcli網(wǎng)絡(luò)管理工具。3、Arulein/lib/udev/rules.d/75-net-description.rulesinstructsudevtofillintheinternaludevdevicepropertyvaluesID_NET_NAME_ONBOARD,ID_NET_NAME_SLOT,ID_NET_NAME_PATH,ID_NET_NAME_MACbyexaminingthenetworkinterfacedevice.Note,thatsomedevicepropertiesmightbeundefined.2、配置網(wǎng)卡使用rhel6版本的網(wǎng)卡配置方式:[root@station66~]#cat/etc/udev/rules.d/70-persistent-net.rules

#Thisfilewasautomaticallygeneratedbythe/lib/udev/write_net_rules#program,runbythepersistent-net-generator.rulesrulesfile.##Youcanmodifyit,aslongasyoukeepeachruleonasingle#line,andchangeonlythevalueoftheNAME=key.#PCIdevice0x8086: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

#Thisisasampleudevrulesfilethatdemonstrateshowtogetudevto#setthenameofIPoIBinterfacestowhateveryouwish.

Thereisa#16characterlimitonnetworkdevicenamesthough,sodon'tgotoonuts##Importantitemstonote:ATTR{type}=="32"isIPoIBinterfaces,andthe#ATTR{address}matchmuststartwith?*andonlyreferencethelast8#bytesoftheaddressorelsetheaddressmightnotmatchonanygiven#startoftheIPoIBstack##Note:asofrhel7,udeviscasesensitiveontheaddressfieldmatch#andalladdressesneedtobeinlowercase.##ACTION=="add",SUBSYSTEM=="net",DRIVERS=="?*",ATTR{type}=="32",ATTR{address}=="?*00:02:c9:03:00:31:78:f2",NAME="mlx4_ib3編輯網(wǎng)卡配置文件ifcfg-eno16777736修改為ifcfg-eth0,修改DEVICE,NAME,HWADDR,NM_CONTROLLED等參數(shù).禁用ipv6和biosdevname功能,傳遞這2個(gè)參數(shù)給kernel:net.ifnames=0ipv6.disable=1,重新生成grub.cfg配置文件即可我們來(lái)具體操作一把:[root@station71network-scripts]#cat/etc/sysconfig/network-scripts/ifcfg-eth0

#這塊叫啥沒(méi)有關(guān)系的哈!TYPE=EthernetHWADDR=00:0c:29:95:b5:21BOOTPROTO=noneNAME=eth0DEVICE=eth0ONBOOT=yesIPADDR=1PREFIX=24GATEWAY=DNS1=51[root@station71~]#vim

/etc/default/grub

+6

#給內(nèi)核傳遞參數(shù)關(guān)閉biosdevname功能關(guān)閉ipv6.GRUB_CMDLINE_LINUX="net.ifnames=0ipv6.disable=1rd.lvm.lv=rootvg/rootrd.lvm.lv=rootvg/swaprhgbquiet"[root@station71~]#grub2-mkconfig

/boot/grub2/grub.cfg

現(xiàn)在重啟看到我們的網(wǎng)卡應(yīng)該是eth0了、如果改個(gè)網(wǎng)卡的名字都需要重啟,那還搞毛線,事實(shí)上是uptime在幾千的很常見(jiàn)。[root@station71network-scripts]#ifconfig

eno16777736

down

[root@station71network-scripts]#ethtool-i

eno16777736

#網(wǎng)卡的驅(qū)動(dòng)名字driver:e1000[root@station71network-scripts]#modinfo

e1000

#網(wǎng)卡的驅(qū)動(dòng)程序所在的模塊filename:

/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/net/ethernet/intel/e1000/e1000.ko[root@station71network-scripts]#modprobe

-r

e1000

#卸載網(wǎng)卡驅(qū)動(dòng)模塊[root@station71network-scripts]#lsmod

|grep

e1000

#查看一下[root@station71network-scripts]#modprobe

e1000

#重新加載網(wǎng)卡驅(qū)動(dòng)3、nmcli工具使用及NetworkManager服務(wù)需求1:配置倆個(gè)虛擬機(jī)網(wǎng)絡(luò),一個(gè)橋接到物理網(wǎng)絡(luò)的無(wú)線路由器,一個(gè)選擇自定義網(wǎng)絡(luò)配置一個(gè)的網(wǎng)段,編輯虛擬機(jī)配置2張網(wǎng)卡。eno16777736用于橋接和eno33554984用于虛擬機(jī)私有網(wǎng)絡(luò)1、給eno16777736配置三個(gè)connection,其中兩個(gè)dhcp自動(dòng)獲取,另外一個(gè)需手動(dòng)配置ip地址信息7/24和gateway配置域名解析地址配置為512、給eno33554984配置一個(gè)connection,需手動(dòng)配置一個(gè)ip地址信息工作一個(gè)號(hào),家庭一個(gè)號(hào),兩不耽誤![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~]#nmcliconnectionaddtypeethernetifnameeno16777736

con-nameeth0Connection'eth0'(3d0ea27f-aee7-4598-9c23-679fde3de18f)successfullyadded.[root@station71~]#nmcliconnectionaddtypeethernetifnameeno16777736

con-nameeth0.homeConnection'eth0.home'(54ef6f15-7981-4f0d-9958-15d6adabb05c)successfullyadded.[root@station71~]#nmcliconnectionaddtypeethernetifnameeno16777736

con-nameeth0.workConnection'eth0.work'(07d80f13-d36d-43f0-9b07-0648dd91e164)successfullyadded.[root@station71~]#nmcliconnectionmodifyeth0ipv4.methodmanualipv4.addresses1/24ipv4.gatewayipv4.dns51[root@station71~]#nmcliconnectionmodifyeth0.homeipv4.methodautoipv4.dns51[root@station71~]#nmcliconnectionmodifyeth0.workipv4.methodautoipv4.dns8[root@station71~]#nmcliconnectionaddtypeethernetifnameeno33554984

con-nameeth2Connection'eth2'(8a97025f-4581-410f-80bd-31b5759970de)successfullyadded.[root@station71~]#nmcliconnectionmodifyeth2ipv4.methodmanualipv4.addresses1/24ipv4.gateway

[root@station71~]#nmcliconnectionupeth0;nmcli

connection

upeth2Connectionsuccessfullyactivated(D-Busactivepath:/org/freedesktop/NetworkManager/ActiveConnection/31)Connectionsuccessfullyactivated(D-Busactivepath:/org/freedesktop/NetworkManager/ActiveConnection/32)[root@station71~]#nmclidevice

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~]#nmcliconnectionshowNAME

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

eno1

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論