【移动应用开发技术】四、config network_第1页
【移动应用开发技术】四、config network_第2页
【移动应用开发技术】四、config network_第3页
【移动应用开发技术】四、config network_第4页
【移动应用开发技术】四、config network_第5页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

【移动应用开发技术】四、confignetwork

1、学习rhel7中新的网络配置工具和网卡命名规则下面这段文字参考红帽官网网络配置第8章2节,在rhel7/centos7中网卡的命名规则有些改变,增加了nmcli网络管理工具。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、配置网卡使用rhel6版本的网卡配置方式:[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编辑网卡配置文件ifcfg-eno16777736修改为ifcfg-eth0,修改DEVICE,NAME,HWADDR,NM_CONTROLLED等参数.禁用ipv6和biosdevname功能,传递这2个参数给kernel:net.ifnames=0ipv6.disable=1,重新生成grub.cfg配置文件即可我们来具体操作一把:[root@station71network-scripts]#cat/etc/sysconfig/network-scripts/ifcfg-eth0

#这块叫啥没有关系的哈!TYPE=EthernetHWADDR=00:0c:29:95:b5:21BOOTPROTO=noneNAME=eth0DEVICE=eth0ONBOOT=yesIPADDR=1PREFIX=24GATEWAY=DNS1=51[root@station71~]#vim

/etc/default/grub

+6

#给内核传递参数关闭biosdevname功能关闭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

现在重启看到我们的网卡应该是eth0了、如果改个网卡的名字都需要重启,那还搞毛线,事实上是uptime在几千的很常见。[root@station71network-scripts]#ifconfig

eno16777736

down

[root@station71network-scripts]#ethtool-i

eno16777736

#网卡的驱动名字driver:e1000[root@station71network-scripts]#modinfo

e1000

#网卡的驱动程序所在的模块filename:

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

-r

e1000

#卸载网卡驱动模块[root@station71network-scripts]#lsmod

|grep

e1000

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

e1000

#重新加载网卡驱动3、nmcli工具使用及NetworkManager服务需求1:配置俩个虚拟机网络,一个桥接到物理网络的无线路由器,一个选择自定义网络配置一个的网段,编辑虚拟机配置2张网卡。eno16777736用于桥接和eno33554984用于虚拟机私有网络1、给eno16777736配置三个connection,其中两个dhcp自动获取,另外一个需手动配置ip地址信息7/24和gateway配置域名解析地址配置为512、给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~]#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. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论