Linux命令之服务器的网络配置hostname,sysctl,ifconfig,service,ifdown,ifup,route,ping的使用
发布时间:2024年01月16日
1、查看当前主机名称,编辑配置文件修改主机名为你姓名拼音的首字母(如张三,则为zs)


2、查看本机网卡IP地址,编辑/etc/sysconfig/network-scripts/ifcfg-ens33,要求在一块物理网卡上绑定2个IP地址,IP地址分别为192.168.1100/24,192.168.1101/24。




3、编辑/etc/hosts文件,实现主机名称(第1题设置的)和IP地址(192.168.1100)的映射关系。ping 主机名,看是否可以ping通。


4、使用ifconfig配置IP地址为192.168.0.168/24及辅助IP地址192.168.0.208/24(注意:临时生效,重启失效)

5、先禁用网卡ens33,ping 192.168.0.168。再启用网卡ens33,ping 192.168.0.168。

6、重新启动network服务。

7、更改ens33网卡MAC地址为00:11:22:33:44:55(注意:临时生效,重启network服务失效)

8、查看本机路由表信息,然后使用route命令设置默认网关为192.168.11.254。

9、加到达目标网络192.168.1.0/24的网络路由,经由ens33网络接口,并由路由器192.168.11.254转发。

10、添加到达192.168.1.10的主机路由,经由ens33网络接口,并由路由器192.168.11.254转发。

11、删除到达目标网络192.168.1.0/24的路由条目,删除到达主机192.168.1.10的路由条目。

文章来源:https://blog.csdn.net/Coin_Collecter/article/details/135637154
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:chenni525@qq.com进行投诉反馈,一经查实,立即删除!