{"id":2286,"date":"2019-09-24T19:27:56","date_gmt":"2019-09-24T12:27:56","guid":{"rendered":"https:\/\/tino.vn\/?post_type=ht_kb&#038;p=2286"},"modified":"2019-09-24T19:27:56","modified_gmt":"2019-09-24T12:27:56","slug":"cau-hinh-ip-tinh-trong-vps","status":"publish","type":"ht_kb","link":"https:\/\/tino.vn\/blog\/docs\/cau-hinh-ip-tinh-trong-vps\/","title":{"rendered":"C\u1ea5u h\u00ecnh IP t\u0129nh trong VPS"},"content":{"rendered":"<p><span>N\u1ebfu b\u1ea1n l\u00e0 qu\u1ea3n tr\u1ecb vi\u00ean h\u1ec7 th\u1ed1ng Linux, s\u1ebd \u0111\u1ebfn l\u00fac b\u1ea1n c\u1ea7n c\u1ea5u h\u00ecnh m\u1ea1ng tr\u00ean h\u1ec7 th\u1ed1ng c\u1ee7a m\u00ecnh.\u00a0<\/span><span class=\"\">Kh\u00f4ng gi\u1ed1ng nh\u01b0 c\u00e1c m\u00e1y t\u00ednh \u0111\u1ec3 b\u00e0n n\u01a1i b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng \u0111\u1ecba ch\u1ec9 IP \u0111\u1ed9ng, tr\u00ean c\u01a1 s\u1edf h\u1ea1 t\u1ea7ng m\u00e1y ch\u1ee7, b\u1ea1n s\u1ebd c\u1ea7n thi\u1ebft l\u1eadp m\u1ed9t \u0111\u1ecba ch\u1ec9 IP t\u0129nh (\u00edt nh\u1ea5t l\u00e0 trong h\u1ea7u h\u1ebft c\u00e1c tr\u01b0\u1eddng h\u1ee3p).<\/span><\/p>\n<p>Gi\u1ea3 \u0111\u1ecbnh:<\/p>\n<p><span class=\"goog-text-highlight\">IP: 192.168.0.100 <\/span><strong><span><span class=\"goog-text-highlight\">Netmask<\/span><\/span><\/strong><span class=\"goog-text-highlight\">\u00a0: 255.255.255.0 <b>hostname<\/b><\/span><span class=\"goog-text-highlight\">: vps.tino.org <\/span><span class=\"goog-text-highlight\">\u00a0<strong>Gateway<\/strong>: 192.168.0.1\u00a0<strong>DNS Server<\/strong>\u00a0<strong>1<\/strong>: 8.8.8.8\u00a0<strong>DNS Server<\/strong>\u00a0<strong>2<\/strong>:\u00a04.4.4.4<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3 id=\"\u0110\u1ecbnh_c\u1ea5u_h\u00ecnh_\u0110\u1ecba_ch\u1ec9_IP_t\u0129nh_trong_RHEL_\/_CentOS_\/_Fedora:\"><span>\u0110\u1ecbnh c\u1ea5u h\u00ecnh \u0110\u1ecba ch\u1ec9 IP t\u0129nh trong RHEL \/ CentOS \/ Fedora:<\/span><\/h3>\n<p>File c\u1ea5u h\u00ecnh:<\/p>\n<pre>\/etc\/sysconfig\/network\r\n\/etc\/sysconfig\/network-scripts\/ifcfg-eth0<\/pre>\n<p>File\u00a0 &#8220;ifcfg-eth0&#8221; c\u1ea5u h\u00ecnh cho giao card m\u1ea1ng eth0. N\u1ebfu giao di\u1ec7n c\u1ee7a b\u1ea1n \u0111\u01b0\u1ee3c \u0111\u1eb7t t\u00ean l\u00e0 eth1&#8243;th\u00ec t\u1eadp tin m\u00e0 b\u1ea1n c\u1ea7n ch\u1ec9nh s\u1eeda l\u00e0 &#8220;ifcfg-eth1&#8221;.<\/p>\n<p>B\u1ea1n c\u00f3 th\u1ec3 ki\u1ec3m tra c\u00e1c card m\u1ea1ng tr\u00ean VPS b\u1eb1ng l\u1ec7nh:<\/p>\n<pre> ifconfig -a\r\nHo\u1eb7c \r\nip addr<\/pre>\n<p>C\u1ea5u h\u00ecnh file: \/etc\/sysconfig\/network<\/p>\n<p>Ch\u1ec9nh s\u1eeda b\u1eb1ng l\u1ec7nh:<\/p>\n<pre># vi \/etc\/sysconfig\/network\r\n<\/pre>\n<p><center><\/center>Open that file and set:<\/p>\n<pre>NETWORKING=yes\r\nHOSTNAME=<span class=\"goog-text-highlight\">vps.tino.org<\/span>\r\nGATEWAY=192.168.0.1\r\nNETWORKING_IPV6=no\r\nIPV6INIT=no\r\n<\/pre>\n<p>S\u1eeda file ti\u1ebfp theo:<\/p>\n<pre># vi \/etc\/sysconfig\/network-scripts\/ifcfg-eth0\r\n<\/pre>\n<p><strong>Note<\/strong>: H\u00e3y \u0111\u1ea3m b\u1ea3o l\u00e0 b\u1ea1n m\u1edf \u0111\u00fang file c\u1ea5u h\u00ecnh card m\u1ea1ng.<\/p>\n<p>Thay \u0111\u1ed5i th\u00f4ng tin:<\/p>\n<pre>DEVICE=\"eth0\"\r\nBOOTPROTO=\"static\"\r\nDNS1=\"8.8.8.8\"\r\nDNS2=\"4.4.4.4\"\r\nGATEWAY=\"192.168.0.1\"\r\nHOSTNAME=\"<span class=\"goog-text-highlight\">vps.tino.org<\/span>\"\r\nHWADDR=\"00:19:99:A4:46:AB\"\r\nIPADDR=\"192.68.0.100\"\r\nNETMASK=\"255.255.255.0\"\r\nNM_CONTROLLED=\"yes\"\r\nONBOOT=\"yes\"\r\nTYPE=\"Ethernet\"\r\nUUID=\"8105c095-799b-4f5a-a445-c6d7c3681f07\"\r\n<\/pre>\n<p>B\u1ea1n ch\u1ec9 c\u1ea7n ch\u1ec9nh s\u1eeda c\u00e1c gi\u00e1 tr\u1ecb sau:<\/p>\n<ol>\n<li>DNS1 and DNS2<\/li>\n<li>GATEWAY<\/li>\n<li>HOSTNAME<\/li>\n<li>NETMASK<\/li>\n<li>IPADDR<\/li>\n<\/ol>\n<p>Ti\u1ebfp theo b\u1ea1n c\u1ea5u h\u00ecnh file\u00a0 qu\u1ea3n l\u00fd m\u00e1y ch\u1ee7 ph\u00e2n gi\u1ea3i DNS.<\/p>\n<p><code>resolve.conf<\/code>B\u1ea1n c\u00f3 th\u1ec3 edit n\u00f3 b\u1eb1ng\u00a0 ph\u1ea7n m\u1ec1m <strong>vi<\/strong> ho\u1eb7c <strong>nano<\/strong><\/p>\n<pre># vi \/etc\/resolv.conf\r\n<\/pre>\n<pre> \u00a0\r\nnameserver 8.8.8.8 # \r\nnameserver 4.4.4.4 #\r\n<\/pre>\n<p>Once you have made your changes restart the networking with:<\/p>\n<pre># \/etc\/init.d\/network restart  [On SysVinit]\r\n# systemctl restart network    [On SystemD]\r\n<\/pre>\n<h3 id=\"\u0110\u1eb7t_\u0111\u1ecba_ch\u1ec9_IP_t\u0129nh_trong_Debian_\/_Ubuntu\"><span>\u0110\u1eb7t \u0111\u1ecba ch\u1ec9 IP t\u0129nh trong Debian \/ Ubuntu<\/span><\/h3>\n<p><span>\u0110\u1ec3 thi\u1ebft l\u1eadp \u0111\u1ecba ch\u1ec9 IP t\u0129nh trong\u00a0<\/span><strong><span>Debian<\/span><\/strong><span>\u00a0\/\u00a0<\/span><strong><span>Ubuntu<\/span><\/strong><span>\u00a0, h\u00e3y m\u1edf t\u1ec7p sau:<\/span><\/p>\n<pre># nano \/etc\/network\/interfaces\r\n<\/pre>\n<p>B\u1ea1n c\u00f3 th\u1ec3 th\u1ea5y m\u1ed9t d\u00f2ng tr\u00f4ng nh\u01b0 th\u1ebf n\u00e0y:<\/p>\n<pre>auto eth0\r\niface eth0 inet dhcp\r\n<\/pre>\n<p>Thay \u0111\u1ed5i th\u00e0nh:<\/p>\n<pre>auto eth0\r\niface eth0 inet static \r\n  address 192.168.0.100\r\n  netmask 255.255.255.0\r\n  gateway 192.168.0.1\r\n  dns-nameservers 4.4.4.4\r\n  dns-nameservers 8.8.8.8\r\n<\/pre>\n<p>L\u01b0u file sau \u0111\u00f3 b\u1ea1n edit ti\u1ebfp file sau:<\/p>\n<p><code>\/etc\/resolv.conf<\/code><\/p>\n<p>l\u1ec7nh edit :<\/p>\n<pre># nano \/etc\/resolv.conf\r\n<\/pre>\n<pre>nameserver 8.8.8.8 \r\nnameserver 4.4.4.4 \r\n<\/pre>\n<p>Kh\u1edfi \u0111\u1ed9ng l\u1ea1i network tr\u00ean VPS.<\/p>\n<pre># \/etc\/init.d\/network restart  [On SysVinit]\r\n# systemctl restart network    [On SystemD]\r\n<\/pre>\n<p>\u0110\u1ecba ch\u1ec9 IP t\u0129nh c\u1ee7a b\u1ea1n \u0111\u00e3 \u0111\u01b0\u1ee3c c\u1ea5u h\u00ecnh.<\/p>\n<h3 id=\"K\u1ebft_lu\u1eadn:\">K\u1ebft lu\u1eadn:<\/h3>\n<p><span>B\u00e2y gi\u1edd b\u1ea1n \u0111\u00e3 bi\u1ebft c\u00e1ch \u0111\u1ecbnh c\u1ea5u h\u00ecnh \u0111\u1ecba ch\u1ec9 IP t\u0129nh tr\u00ean VPS Linux. <\/span><span>N\u1ebfu b\u1ea1n c\u00f3 b\u1ea5t k\u1ef3 c\u00e2u h\u1ecfi ho\u1eb7c \u00fd ki\u1ebfn, xin vui l\u00f2ng g\u1eedi ch\u00fang trong ph\u1ea7n b\u00ecnh lu\u1eadn d\u01b0\u1edbi \u0111\u00e2y.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>N\u1ebfu b\u1ea1n l\u00e0 qu\u1ea3n tr\u1ecb vi\u00ean h\u1ec7 th\u1ed1ng Linux, s\u1ebd \u0111\u1ebfn l\u00fac b\u1ea1n c\u1ea7n c\u1ea5u h\u00ecnh m\u1ea1ng tr\u00ean h\u1ec7 th\u1ed1ng c\u1ee7a m\u00ecnh.\u00a0Kh\u00f4ng gi\u1ed1ng nh\u01b0 c\u00e1c m\u00e1y t\u00ednh \u0111\u1ec3 b\u00e0n n\u01a1i b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng \u0111\u1ecba ch\u1ec9 IP \u0111\u1ed9ng, tr\u00ean c\u01a1 s\u1edf h\u1ea1 t\u1ea7ng m\u00e1y ch\u1ee7, b\u1ea1n s\u1ebd c\u1ea7n thi\u1ebft l\u1eadp m\u1ed9t \u0111\u1ecba ch\u1ec9 IP [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":16424,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"tags":[],"ht_kb_category":[17],"class_list":["post-2286","ht_kb","type-ht_kb","status-publish","format-standard","has-post-thumbnail","hentry","ht_kb_category-huong-dan-ve-cloud-vps"],"_links":{"self":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/ht_kb\/2286","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/ht_kb"}],"about":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/comments?post=2286"}],"version-history":[{"count":0,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/ht_kb\/2286\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media\/16424"}],"wp:attachment":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media?parent=2286"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/tags?post=2286"},{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/ht_kb_category?post=2286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}