春节期间因为疫情假期延长,导致连续鸽了两个星期,同时最近有点忙,会尽快补上的。
这一篇记录一下CentOS系统网络设置相关的命令。
查询当前IP地址
ifconfig

eth+序号代表不同的网络设置,对应的inet值即为各自IP地址。
如果显示ifconfig未安装(CentOS minimize最小化安装时一般不带),可以使用以下命令。
ip addr

如果没有inet对应的值,可以修改网络配置文件
vi /etc/sysconfig/network-scripts/ifcfg-eth0 ONBOOT=yes #开机自启动,然后保存此文件 systemctl restart network # 重启网络服务
也可以使用service network restart命令重启网络服务。
修改IP地址
vi /etc/sysconfig/network-scripts/ifcfg-eth0 BOOTPROTO=static #静态IP,默认为dhcp动态IP ONBOOT=yes #开机自启 IPADDR=192.168.0.230 #静态IP GATEWAY=192.168.0.1 #默认网关 NETMASK=255.255.255.0 #子网掩码 DNS1=192.168.0.1 #DNS 配置 DNS2=8.8.8.8 systemctl restart network#重启网络服务
另外可以试试nm-connection-editor(安装图形界面才能使用)和nmtui,图形化修改网络设置。
临时设置网络
重启网络服务后失效
ifconfig eth0 10.0.0.10 netmask 255.0.0.0 #设置IP和子网掩码 route add default gw 10.0.0.1 #设置网关 ifconfig eth0 hw ether 00:11:00:00:11:11 #设置物理地址(MAC地址) ifconfig eth0 up #启用eth0网络 ifconfig eth0 down #关闭eth0网络
修改hosts文件
hosts文件路径为/etc/hosts,与windows的hosts修改方式相同。
After all,tomorrow is another day.
毕竟,明天又是崭新的一天。
《飘》
——玛格丽特·米切尔


评论
Проститутки Черниковки для пар
787858 629211Someone essentially assist to make severely posts I might state. That could be the quite first time I frequented your internet site page and so far? I surprised with the analysis you made to create this certain submit incredible. Magnificent task! 925013
190660 239883Paris Hilton: So lovely spending time with Manny and h 952188
Стоматологическое оборудование: обзор видов, возможностей и выбора для клиники
диагностическое оборудование (рентген-аппараты, интраоральные камеры, 3D-сканеры);
Хирургическое оборудование: точность и безопасность
Стоматологическое оборудование: обзор видов, возможностей и выбора для клиники
833016 958931Magnificent beat ! I would like to apprentice whilst you amend your web site, how could i subscribe for a weblog internet site? The account helped me a appropriate deal. I had been just a little bit acquainted of this your broadcast provided brilliant transparent idea 241405
The points about this overview of the role of balanced nutrition while keeping expectations realistic.
Good information about comparing supplement products without overcomplicating the subject.
This explanation is easy to follow. It is a good idea to make an informed decision rather than relying on advertising alone. This gives me several points to check next.
This is a useful introduction to the information about understanding probiotics while keeping expectations realistic.
I enjoyed learning about the information about the difference between wellness support and medical treatment and encourages careful consideration.
It’s useful to learn about how this article covers comparing nail care products in clear language.
The explanation of how this article covers monitoring glucose as recommended by a clinician that is practical and straightforward.
I found this article useful. It is sensible to check the full ingredient list and serving directions. I will use this as a starting point for further research.
Проведение поверки водосчетчика без снятия
Great article with a lot of useful context.\
Важно
Thanks for creating another informative resource.\
This article is a helpful read. The article highlights why informed choices matter. Thanks again for sharing a useful resource.
Thanks for sharing this article. It is sensible to compare information from reliable sources. I will be checking out more of the information on this site.
This was an easy read. It is good to see attention given to both potential benefits and limitations. I found this discussion worthwhile.
This post offers a good starting point. The clear structure makes it easier to follow the main ideas. I found this discussion worthwhile.
I like how clearly the subject is presented. It helps to understand both the possibilities and the limitations discussed. The balanced tone is appreciated.
744388 176497What web host are you the use of? Can I am getting your associate hyperlink to your host? I desire web site loaded up as fast as yours lol 55977
This post offers a good starting point. The points here encourage readers to think carefully about their options. This was time well spent.
I learned something useful from this post. Readers can use these points to prepare more focused questions for a professional. This is a good starting point for anyone learning about the topic.
There are several useful points here. It is always worth checking trustworthy sources before acting on health information. I appreciate the time taken to explain the subject.
I appreciate the practical information here. The points here can help readers prepare more focused questions. Looking forward to reading more articles like this.