Notice
Recent Posts
Recent Comments
Link
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

Geon

리눅스 mac 순서 변경 본문

Linux

리눅스 mac 순서 변경

jgkim1008 2020. 12. 29. 23:16

#!/usr/bin/sh

mac1=`ifconfig eth0 |grep ether |awk '{print $2}'`

mac2=`ifconfig eth1 |grep ether |awk '{print $2}'`

echo $mac1

echo $mac2

################################# mac change ##############################

sed -i "6s/.*/GRUB_CMDLINE_LINUX=\"crashkernel=auto rhgb quiet net.ifnames=0 biosdevname=0 ipv6.disable=1 ifname=ether0:$mac2 ifname=ether1:$mac1\"/g" /etc/default/grub

 

File=/etc/udev/rules.d/70-persistent-net.rules

echo "SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS==\"?*\", ATTR{address}==\"$mac2\", ATTR{type}==\"1\", KERNEL==\"eth*\", NAME=\"eth0\"" > $File

echo "SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS==\"?*\", ATTR{address}==\"$mac1\", ATTR{type}==\"1\", KERNEL==\"eth*\", NAME=\"eth1\"" >> $File

######################## grub install #######################

grub2-mkconfig -o /boot/grub2/grub.cfg && dracut -f -v && shutdown -r 0 

'Linux' 카테고리의 다른 글

패킷 모니터링(tcpdump)  (0) 2021.01.19
디스크 예약 블록  (0) 2021.01.19
read-only  (0) 2021.01.19
Trunk 포트(Tagged 포트)?  (0) 2021.01.19