๐Ÿ“  Secure/๐Ÿ”‘ ๋ณด์•ˆ

wsl2 bridge ๋ชจ๋“œ ์ „ํ™˜๋ฒ• (+wsl2 systemctl ์—๋Ÿฌ ํ•ด๊ฒฐ๋ฒ•)

sa1t 2024. 7. 16. 10:27
๋ฐ˜์‘ํ˜•

์ผ๋‹จ wsl kali linux๋Š” win11๋ฒ„์ „์—์„œ๋งŒ ๋ธŒ๋ฆฟ์ง€๋ฅผ ์ง€์›ํ•œ๋‹ค.

win10์—์„œ hyper ๋งค๋‹ˆ์ € ๊ฐ€์ƒ์Šค์œ„์น˜๋ฅผ ๋งŒ๋“ค๊ธฐ๋ฅผ ํ•ด์„œ ์‹คํŒจ๋ฅผ ํ–ˆ๋‹ค๋ฉด win11๋กœ ์—…๋ฐ์ดํŠธ ์ถ”์ฒœ

 

[windows ๊ธฐ๋Šฅ ์ผœ๊ธฐ/๋„๊ธฐ] > [Hyper-V] ์ผœ๊ธฐ / ์žฌ๋ถ€ํŒ… > Hyper-V ๋งค๋‹ˆ์ € ์‹คํ–‰

์ ์šฉ ์‹œ ๋„คํŠธ์›Œํฌ ์„ค์ •๊ณผ์ •์—์„œ ํ˜„์žฌ ์—ฐ๊ฒฐ์ƒํƒœ ๋ณ€๊ฒฝํ•œ๋‹ค๋Š” ๊ฒฝ๊ณ ๊ฐ€ ๋œจ๋Š”๋ฐ YES ๋ˆŒ๋Ÿฌ์„œ ์ง„ํ–‰ํ•˜๋ฉด ๋œ๋‹ค.

๊ทธ ํ›„ ์‚ฌ์šฉ์ž ํ™ˆ ๋””๋ ‰ํ† ๋ฆฌ์— .wslconfigํŒŒ์ผ ์ƒ์„ฑํ•œ๋‹ค.

> copy con .wslconfig
[WSL2]
networkingMode = bridged
vmSwitch = wsl2ex
๊ทธ ํ›„ ctrl+z ํ˜น์€ ctrl+c๋กœ ํŒŒ์ผ ์ƒ์„ฑ

> wsl --shutdown

shutdown ํ›„ ๋‹ค์‹œ ์นผ๋ฆฌ ์‹คํ–‰ ํ›„ ifconfig๋ฅผ ํ•˜๋ฉด 192.168.n.n์œผ๋กœ ์™ธ๋ถ€๋ง์˜ IP๋ฅผ ํ• ๋‹น๋ฐ›์•„ ์‚ฌ์šฉ๋˜๋Š”๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

 

 

WSL2 ์˜ค๋ฅ˜ ํ•ด๊ฒฐ๋ฒ•
System has not been booted with systemd as init system (PID 1). 
Can't operate. Failed to connect to bus: Host is down

๋‚œ ์ด ์˜ค๋ฅ˜๊ฐ€ kali์—์„œ openvpn ์„ค์ •ํ•˜๋‹ค๊ฐ€ ์ผ์–ด๋‚ฌ๊ธฐ๋•Œ๋ฌธ์— ์ผ๋‹จ kali ์ ‘์†

# sudo -e /etc/wsl.conf
[boot]
systemd=true

๊ทธ ํ›„ wsl --shutdown์œผ๋กœ kali๋ฅผ ์ข…๋ฃŒ์‹œ์ผœ์ค€๋‹ค.

$ sudo su
# systemctl status
root@server ~ # systemctl status
โ— server
State: degraded

state ์ƒํƒœ๊ฐ€ degraded์˜€์—ˆ๊ธฐ ๋•Œ๋ฌธ์— ์•ˆ๋๋˜๊ฒƒ ...

# systemctl --failed

ํ•ด๋‹น ๋ช…๋ น์–ด๋กœ failed ์ด์œ ๋ฅผ ํ™•์ธํ•˜๊ณ 

# systemctl reset-failed

reset failed ์‹คํ–‰ ํ›„ ๋‹ค์‹œ ์ƒํƒœ ํ™•์ธํ•˜๋ฉด running์ด ๋˜๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

๋ฐ˜์‘ํ˜•