版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Centos7网卡配置Linux有两种网络服务的管理组件:network/NetworkManager方法一:network查看网卡信息[root@localhost~]#ipa[roDt(aiocalhostT#ipa1:lo:<L00PBACKhUPfLOWERUP>mtu65536qdiscnoqueuestateUNKNOWNgroupdefaultqlenlw«0link/loopback00:00:00:SO;QO:00brdCO:00:DO;OG:GO:00ineT127.0.0.1/8scopehostIdvalid_lftforeverpreferredlft~oreverine:6::1/izbscopehast2:ens?3:^BROADCAST,MULTICAST,UPHLOWER_LP>mtu15GGqdiscpfifofaststateUPgroupdefaultqlen1O0G:linkf&th亡「3D:Or:29:了日:43:E5b「d1~「:ff:ff:f「;ff:ff:3:virbro:^NO-CARRZER,BROADCAST,MULTICAST,UP>ntt1503qdiscnoqueueEtateDOWNgroupdecanit^Len1QG0link/ether5?:54:ee:ri:37:odbrdf「:f『:「「:1■「:ff:仃ine7192.168.122.1/24brd192.1GS.122.255scopeglobalvirbrOval.id_lftforeverpreferredlf7forever4:virbro-nic:<broadca5Tjmjlticast>idtuisooqdiscpfifo_"astmastervirbrosta1eDOWNgroupdefaul!qlenLOGOlink/ether52:54:QG:f1:37:Qdbrdff:if:ff:ff:if:幵这里查看到网卡ens33修改网卡配置文件[root@localhost~]#cd/etc/sysconfig/network-scripts/[root@localhostnetwork-scripts]#ls可以查看到网卡配置文件ifcfg-ens33
ifcfg-en?331ifdown-pppifup-ibifup-TearniTCTg-Loifcfg-en?331ifdown-pppifup-ibifup-TearniTCTg-Loifdown-routesifup-ipppifup-TeanForTifdownifdown-sitifup-ipv6ifup-tunnellfdown-bnepifdown-Teamifup-isdnifup-wirelessitdown-ethi.fdown-TeamPor-itup-plipl.nit.ipvfi-globalIfdown'ibif-Jown-Tunnelifup-plusbnetwork-functionsifdoi^n-ipppifupifup-postnetwork-iunctions-ipv6ifdowri'ipvfiifup-aliasesifup-pppi^down-Lsdnifup-bnepifup-routesifdohrn-postifup-ethifup-sit[root(aiocalhostnetwork-scri.pt:£]#network-scripts]#Is[rooL(alocalhost-]#cd/etcfsysconflg/neTwork-sciipts/原配置文件rYPE=Ethern已TPF<OXY_METHOD=n0neBROW£ER_ONLY=noBOOTPHOTO=noneOEFROUTE^/esIPV4FAILJRE_FATAL=noIPV6亍1«丁=廿己厂IPV6AUTOCDMF=yesIPYG^DEFROLITIZ=ytsIPV6^FAILJRE_FATAL=noIPV6_flDDR_GEN_M0DE=stable-privacyNAT1E^eii533LIUID=f25fcd55cce5-4eaaaOfO-f837651a7712DEVICE=ens33□NB00T=no修改后的配置文件(主要修改红色标注)TYPE=EthernetPROXY卜1匚THOD=noneBO[)TPR070=staticptr^ou1t-ye5IPV4FAILUREFATAL=noIPV6亍町丁=唇一IPW6_AUTOCONF=ye5IPV&2DEFROUTE=ye5IPU6_FAILUREFATAL^noIP76_ADDR_GEN_MOUt=stable-privacyNAME=eri5337651a7712DEVICE=ens33pNB00T=yesIPADDR=192.150.137.11NETMASK=255.255.255.0GATEWAY=192.168.137.2DNS1^192.168.2.2保存配置文件退出[root@localhost]#mount-a(检查配置文件是否编辑有误)[iooT^aiocalhost[roottglocalhost[iooT^aiocalhost[roottglocalhost[rooTgLocalhostrITaEHi■為1hlfie+netvork-scrLpTs]#network-scriptsnetwork-scripts]#、i仝vimlTcTg-ens33mount-acdIl3•重启网卡,使配置生效[root@localhost~]#systemctlrestartnetworkLroot@iocaLnast~j#[roaT^lccalhastsystemctlrestartnetwork再次查看网卡信息[root@localhost~]#ipa|naot@tocalhast-]#ipa1:lo:<loopback;urrlowerup>mtu65536qdiscnoqueuestateunknowngroupdefaultqleri1000link/loopback00;GO;GD;00;OG:OQbrdGO;00;Ofl;OQ;DG;00inet127.0.0.1/bscopehas7tovalid_lftfoReverpreferred_lftforeve『iiietG::1/128scopehost廿日1空申ere叩巴尸fEmrur12:ens33:<BROADCASTFNULTICA£'I,UPHLOWERUP>mtu15Q0qdiscpfifofaststateUPgroupdefdultqlen13DQ1ink/ether00:Gc;29:7a;40;35brri-ff:-f:ff;ff:f-F:f-iret192.16E.137.11/24brd192.168.137.255scopeglobalnoprefixrouteens33valid1ftfoReverpreferred1ftforeve『inet(3feSG::9213:e64817abbiadbG/64scape1inknoprefixrautevalid1ftfo^everpreferred1ftforeverP:vlrbrG:<N0■CARRIER,BROADCASTHMULTICAST,UP>nitu1500qciiscnoqueuestateDOWNgroupdefaultqlenlooelink/cther32:54:66:fl:37:Sdbrdff:ff:ff;ff;ff:ffiret192.168.122.1/24b-d192.160.122.255scopeglobalvirbrOvalid1fttoReverpreferredLf1forever4:vlrbro-iiLc:^broadcast;multicast>mtul^ooqdiscp^ifofastmastervirbrostateDDWMgrouprie~aultqlen1000link/ether52:51:00:"1:37:Odbrdtt:"t:tt:tt:tt:t"[rnntffllnr^lhn,^-~1a-I4.Ping命令测试同网段IP是否连通[root@localhost~]#ping192.168.137.1[IIL弋LWULII4LFJ!LJ77[root^localhast-]#ping19216B137.1FINO132.166.137.1(1^2.ISE.137.I)56(G4)b/TSSOfdata.64646464ACbytesbytesbytes■from■fromfrom■from192.168.137.1192.168.137.1192.16G.137.1192.168.137.1icmp_seq=licmp_seq=2icmp_5eq=3icmp?eq=41=64ttl=64Ttl=b41=64tiwtimEtimetimeL.32ms&.5G5msL.04msL.IEms------192.168,1371ping4packetsLransinitted,rttmin/avg/max/mdev-Iroot^locaLhost~1#Is~atistics---4received,0叢^acke;I055rtine3007ms0.505/1.015/1.325/0.312msjTmrmpnjuamiTSTiieiwuijTmrmpnjuamiTSTiieiwui±pL^j#[rnntOlnralhn^tnp+wnrk-rrin+1Jf输完命令回车后,提示连接ens37网卡成功,再来查看网卡配置文件和IP方法二:NetworkManager给虚拟机重新添加一块网卡,网络适配器2唤件选哽iaslia^26Bfcb理器2Qn^'(SCSI)3DGB厂meJtpi匚、iTlTtt田右4±FuLdNi-crvUZ专卜茫-.~」罟L.-:>(VMnetS(fWTJ砌络适配寻2L(VMnetS(MM)^lUSB三卫兰T?耳4:ELf^.L:.n吕3厂:呵(/-■+ii-Tf:?-j-訂l:.:T1.
指定井配给此虛拟机的内存堪。内存犬的倍亂几池||上jpMj:2040:MB3GBV2刖■1GB補■晟衣建仪内存512MBCE':.it^J可龍r汀〒一匕)Z56MB128MB■建尉存&4MB1GB32MB建仅的最小畜户拭標柞系覘内存1.查看网卡信息[root@localhost~]#ipa[roatOil-acalhc^t~#ipa1:Id:cLOOPEACK,UP,LOWEFt_UP^mtnG5536qciiscnoqueue5tateUNKPIOWNgroupdefaultqlen1GOGIink/loopback00:00:00:00:30:00brdOfl:00:OG:GO:OG:GOinet127.9.0.1/S^capehastlaforeverprererred_lTtf□reverinetG::1/12Bscopehost2:en^33:<BR0ADCAST,MULTICftSTrUPHLOWER_UP>intu15OGqdiscpfifa_5ristststeUPgroupdeTsuitqlen10GDIink/etherOG:6c;29;f4;2c;S5trdf「:「Df「:「f:f「:f"Finet192.16S13710/24brd192.16E137255scopegiobrilnoprerixrouteens33inetGfeBD::6b55:985:6530:9a04/fi4百匚opeIinkroprefix『diitevalid_lftforeverptf5frred_lrtforever3;vi-brO:<N0-CARRIER,BROADCAST,MUITTCASTJ.IP>1500qdiscnoqueuestate7i闻Mgroupdefaultqlen16BBlink/ether52;54;BB;B5:7b;斗4brdff;ff;ff;ff:ff;ffinet192163,122,1/24brd152,168,1.22,255scopeglobalvirbrOvali^H2-foreverpreferred_lftforever4;vi-bro-nic:<BROADCASTrMUiTICAST>mtii15佃qdiscpfifofastmastervirbrOstateDOWNgroupdefaultqlen100G5;en537:<BROADCAST,MULTICftST,HP,LOWEI^LIP>mtn1500qdiscpfifo_-Fa5tstateIIPgroupdefauTtqlen1886link/ether88;Sc:29;f4:2c:Sfbrdff;ff;ff;ff:ff;ff1net6feBO:;13bb;alf5;-bd2:54g0/64scope1inknoprefi_xroutevali^H2-foreverpreferred_lftforeverI*i~inn"l"aTHm~c4"县这里查看到网卡ens33是已经配置过的,有IP地址,网卡ens37是刚刚新添加的网卡,还没有配置IP[root@localhost~]#cd/etc/sysconfig/network-scripts/[root@localhostnetwork-scripts]#lsL1M3VXJ3L■25L」EronTral(ic^lhn^Trd/Ate/^v-Rrnriifin^nptwork-sc『IoKFrout@localhQStnetwork-scrLp~s]#1空ifffg-en533ifdown-ppp■iflip-1bi-iip-TeanLfcfgloifdownroutesifupipppi~upTeamPortifdown-sitifup-ipv&i^up-tiinncLifdown-brepltaown-reamifup-wireless_fdown-et[iiftlown-TeamPortifup-plipinLt.ipve-globalifriawn-ibjfdewn-binneliPup-plusbnetwnrk-riinctionsifdown-ipppifupifup-p057network-functions-ipv6ifdownipv6ifup-aliasesitup-pppifdowi-isdrlfup-br.epifup-routes_fdown-pottifup-elhiTup-sll[root@localha51network-s匚「ip^-s]#这里可以看到只有ens33网卡的配置文件,没有ens37的配置文件,接下来我们就用NetworkManager服务的命令来生成配置文件并且配置IP地址[root@localhost~]#nmcliconnectionaddcon-nameens37typeethernetifnameens37ipv4.methodmanualipv4.addresses192.168.137.11/24autoconnectyesi-doun■lsdniTup-bncpiTup-routesi^doun-postifup-ethifup-sitIrootSlocalhostnetwork-scriptsl#nmcliconnectionoddconnameen&37typeeThernctitnameConnection1en537'(13-7755-4734--9a3celb40pfa)successful1yadded.『eci询"片『eci询"片1hnvrnetwork-riotsi#1sifctg-ens33Lfdown-ipv6ltdown-Tunnelitup-isdnitup-TeamPortifcig-ens37Lfdcwn-isdnifupifupplipifuptunnelLFn订Imfdown-postLfup-alLasesLTup-plusbifup-'hijrelessifdcwnifdown-pppifup-bnepitup-postimt.ipvfc-globalifdown-bnepifdown-routesifup-ethifuppppnetwork-functionsifdown-ethifclown-sitifup-ibifup-routesnttwork-functions-iiDV^ifdcwn-Lbifdown-reamifup-ipppifup-S1Tifdcwn-ipppitdown-TeamPortifup-ipv6itup-Team[root(aiocalhostnetwork-scriptsJ#catifciq-ens37TYPF=EtfiernetPRO>Y_METHOD=noneBROWSERONLY=nDIPADDR=L92.163.137.11PREFIX=2flDEFROUTE=yesTPV4_FAIILIPF_FATAI=00丄叫#i>i丄yy乱一IPV6AUTOCONF=yesIPV6_DEFR0UTE=ye5IPV6_FAILURE_FATAL=n3IPV62AD[)R_GEr*_MODE=stab'Le-PrivacyMAHE=ens37JUI[]>a0eB3213-7703-473^-3988-9a3celb4SeTaDEVICE=ens370MB00T-/es[root(aiocalho51network-scripts]#2.再重启网卡[root@localhost~]#systemctlrestartnetwork[root^localhostnetworkscripts]#ipa1:Lo:<LOOP(JACK,.UP,.LOWERUPb-mtuqdiscnoquenestateuriKriUwblgroupde-aultqlen1UULink/loopbackuu:uu:uu:uu:uu:uubrduu:uu:uu:uu:uu:uumet127.a.u.1/&scopehastlovalidl~t~oreverprc~erredL~t~oreverinetb::1/12Uscopehostvalidl~t~*reverpre~erredL~t~orever2:ens33:<eROA[JCAST,MULTICAST,UPLOWbAUP>mtn15UUqdiscp~i~o~aststateUPgroupde~anLtqlen1UUULink/ether□□:Uc:29:f4:2c:SSbrd==:==
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024年中国跨平台数据复制系统市场调查研究报告
- 幼儿园微课程设计封面
- 2024年中国精密一体正弦磁盘市场调查研究报告
- 2024至2030年新脱苯聚酯漆项目投资价值分析报告
- 酒店管理实习工作报告
- 楼梯课程设计计划
- 《HS汽贸集团销售组织体系优化研究》
- 方套课程设计
- 2024年空心棉口罩项目可行性研究报告
- 2024年棉毛高领长袖衫项目可行性研究报告
- 2024年房地产经纪协理考试题库附参考答案(综合题)
- 考试保密培训课件教学
- 中药在护理中的应用
- 电工基础技能实训指导书
- 脊柱外科临床指南
- 万千教育学前透视幼儿的户外学习
- 《抗菌药物知识培训》课件
- 2024年北京市安全员A证考试题库附答案
- 医疗专业人员的情绪管理培训
- 天猫食品委托加工协议合同书x
- 露营基地项目投资计划书
评论
0/150
提交评论