CentOS linux 修改MAC地址

 

 

1、首先查看网卡信息:

[root@localhost ~]# ifconfig

eth0      Link encap:Ethernet  HWaddr 00:0C:29:49:22:C8  

          inet addr:10.65.7.182  Bcast:10.65.7.255  Mask:255.255.255.0

          inet6 addr: fe80::20c:29ff:fe49:22c8/64 Scope:Link

。。。

 

 

上面显示,设备eth0的MAC信息,即硬件地址HWaddr 00:0C:29:49:22:C8  

2、关闭eth0,因为会关闭网络服务,所以这要求直接操作本地机器

[root@localhost ~]# ifconfig eth0 down

3、修改MAC信息为00:0C:29:49:22:C1

[root@localhost ~]# ifconfig eth0 hw ether 00:00:00:00:00:C1

4、启动eth0

[root@localhost ~]# ifconfig eth0 up

5、查看修改后的网卡信息:

[root@localhost ~]# ifconfig

eth0      Link encap:Ethernet  HWaddr 00:00:00:00:00:C1

          inet addr:10.65.7.182  Bcast:10.65.7.255  Mask:255.255.255.0

          inet6 addr: fe80::20c:29ff:fe49:22c1/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:3470 errors:0 dropped:0 overruns:0 frame:0

          TX packets:1509 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:907742 (886.4 KiB)  TX bytes:182280 (178.0 KiB)

          Interrupt:67 Base address:0x2024 

 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:1505 errors:0 dropped:0 overruns:0 frame:0

          TX packets:1505 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:2414590 (2.3 MiB)  TX bytes:2414590 (2.3 MiB)

 

★★★★★★★★★★★★

永久修改MAC信息:

打开/etc/rc.d/rc.local ,追加三行内容:

ifconfig eth0 down

ifconfig eth0 hw ether 00:00:00:00:00:C1

ifconfig eth0 up

然后重启

 

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是CentOS Linux基本安全配置的步骤: 1. 更新系统:使用以下命令检查系统是否有可用的更新: ``` yum check-update ``` 如果有可用更新,请使用以下命令升级系统: ``` yum update ``` 2. 安装防火墙:CentOS默认使用的防火墙是firewalld。您可以使用以下命令安装和启动它: ``` yum install firewalld systemctl start firewalld systemctl enable firewalld ``` 3. 禁用不必要的服务:在CentOS上运行的许多服务都是不必要的,这些服务可能会增加系统的攻击面。您可以使用以下命令列出所有正在运行的服务: ``` systemctl list-unit-files --type=service | grep enabled ``` 您可以使用以下命令禁用不必要的服务: ``` systemctl stop [service name] systemctl disable [service name] ``` 4. 创建新用户并禁用root登录:使用以下命令创建一个新的sudo用户: ``` adduser [username] passwd [username] usermod -aG wheel [username] ``` 然后,编辑 /etc/ssh/sshd_config 文件,找到以下行: ``` #PermitRootLogin yes ``` 将其更改为: ``` PermitRootLogin no ``` 最后,重新启动SSH服务: ``` systemctl restart sshd ``` 5. 安装和配置SELinux:SELinux是一种强制访问控制(MAC)系统,可以限制系统和应用程序的访问权限。您可以使用以下命令安装SELinux: ``` yum install selinux-policy selinux-policy-targeted ``` 然后,编辑 /etc/selinux/config 文件,找到以下行: ``` SELINUX=enforcing ``` 将其更改为: ``` SELINUX=permissive ``` 最后,重新启动系统。 这些是CentOS Linux基本安全配置的步骤。完成这些步骤后,您的系统应该更加安全,更难受到攻击。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值