Modifying Network Connection in Linux

Network ကို configuration လုပ္ေတာ့မယ္ဆိုရင္ network interfaces ေတြရဲ့ configuration files ေတြကိုျပုျပင္ျခင္းနဲ့လည္းလုပ္လို့ရပါတယ္။ interface configuration file ဆိုတာကေတာ့ network devices ေတြရဲ့ software interfaces ေတြကို control လုပ္တဲ့ files ေတြကိုေျပာတာပါ။ဒီ file ေတြကိုမ်ားေသာအားျဖင့္ /etc/sysconfig/network-scripts/ifcfg-<name> ဆိုတဲ့ေနရာမွာထားပါတယ္။ <name> ဆိုတာကေတာ့ device ေတြရဲ့ interface name ကိုေျပာတာပါ။ေအာက္ကဇယားက variables ေတြကေတာ့ interface ေတြကို static (or) dynamic configuration လုပ္တဲ့အခ်ိန္မွာသံုးတဲ့variables ေတြပါ။
ပံုထဲမွာဆိုရင္ ip address, prefix, gateway ေတြ၊ DNS အတြက္ numbers ေတြကို assign လုပ္ေပးထားတာကိုျမင္ရမွာပါ။
configuration file ကို ျပုျပင္ျပီးရင္ေတာ့ nmcli con reload ဆိုတဲ့ command နဲ့ NetworkManager က configuration file ကို read လုပ္ေအာင္လုပ္ေပးရပါမယ္။အဲ့လုိလုပ္ျပီးတဲ့အခါမွာ interfaces ေတြကိုလည္း restart လုပ္ဖို့လိုအပ္ပါေသးတယ္။
[root@demo ~]# nmcli con reload [root@demo ~]# nmcli con down "System eth0" [root@demo ~]# nmcli con up "System eth0"
အဲ့ဒါဆိုရင္ က်ေနာ္တို့ exercise ေလးလုပ္ျကည့္ျကရေအာင္။
၁. root user အေနနဲ့ login ၀င္ပါ။ျပီးရင္ serverX နဲ့ desktopX ရဲ့ /etc/sysconfig/network-scripts/ifcfg-eth0 ကို IPv4 address 10.0.x.x နဲ့ ip ေပးပါမယ္။
[root@serverX ~]# echo "IPADDR1=10.0.x.1" >> /etc/sysconfig/network-scripts/ifcfg-eth0 [root@desktopX ~]# echo "IPADDR1=10.0.x.1" >> /etc/sysconfig/network-scripts/ifcfg-eth0
၂. Network prefix ထည့္ပါမယ္။
root@serverX ~]# echo "PREFIX1=24" >> /etc/sysconfig/network-scripts/ifcfg-eth0 root@desktopX ~]# echo "PREFIX1=24" >> /etc/sysconfig/network-scripts/ifcfg-eth0
၃.အေပါ္မွာေျပာခဲ့သလိုပဲ config file ကိုျပင္ျပီးျပီဆိုရင္လုပ္ရမဲ့ step ေတြအတိုင္းလုပ္ပါမယ္။
[root@serverX ~]# nmcli con reload [root@serverX ~]# nmcli con down "System eth0" [root@serverX ~]# nmcli con up "System eth0" [root@desktopX ~]# nmcli con reload [root@desktopX ~]# nmcli con down "System eth0" [root@desktopX ~]# nmcli con up "System eth0"
၄. On serverX, က်ေနာ္တုိ့ configuration လုပ္ခဲ့တဲ့ network address ကို check လုပ္ျကည့္ပါမယ္။
[root@serverX ~]# ip addr
၅. On serverX, ping ျကည့္မယ္။
[root@serverX ~]# ping 10.0.x.2
၆. On desktopX, ip ျကည့္မယ္။
[root@serverX ~]# ip addr
၇. On desktopX, ping ျကည့္မယ္။
[root@serverX ~]# ping 10.0.x.1

### Thanks for reading ###

Popular posts from this blog

Buffer overflow Part(2)

Docker containers ေတြအျမဲတမ္း up and running ျဖစ္ေနေအာင္ docker's restart policy ေတြကိုဘယ္လိုသံုးသင့္လဲ။

Ubuntu 18.10 Release Date and New Features