{"id":5101,"date":"2018-12-25T14:42:10","date_gmt":"2018-12-25T07:42:10","guid":{"rendered":"https:\/\/cloud.z.com\/vn\/?p=5101"},"modified":"2018-12-25T14:42:10","modified_gmt":"2018-12-25T07:42:10","slug":"huong-dan-fix-bug-memcached-ngan-chan-ddos","status":"publish","type":"post","link":"https:\/\/cloud.z.com\/vn\/support\/cloud\/huong-dan-fix-bug-memcached-ngan-chan-ddos\/","title":{"rendered":"H\u01b0\u1edbng d\u1eabn fix bug Memcached, ng\u0103n ch\u1eb7n DDoS"},"content":{"rendered":"<p><\/p>\n<p>H\u01b0\u1edbng d\u1eabn fix bug Memcached, ng\u0103n ch\u1eb7n DDoS<\/p>\n<p><img src=\"https:\/\/lh3.googleusercontent.com\/xhIDaMqpw93C-INY0sBj2SMx4h5YsMiNLcWGDnRDkIe5zVvbuFcNPfcgdALemlrnHIOH3QJAgfga2U2hEsJwC0cgyq-XgG7kCmVYxQ9AFU_AZVDuH0C8XtBLTsIoHrX0mGddtbwA\" alt=\"\" \/><\/p>\n<p dir=\"ltr\">Theo Arbor Networks, c\u00e1c truy v\u1ea5n gi\u1ea3 m\u1ea1o c\u0169ng h\u01b0\u1edbng \u0111\u1ebfn TCP c\u1ed5ng 11211, nh\u01b0ng v\u00ec c\u00e1c truy v\u1ea5n TCP kh\u00f4ng th\u1ec3 gi\u1ea3 m\u1ea1o n\u00ean c\u00e1ch t\u1ea5n c\u00f4ng n\u00e0y \u00edt b\u1ecb l\u1ea1m d\u1ee5ng h\u01a1n.<\/p>\n<p dir=\"ltr\">Theo s\u1ed1 li\u1ec7u m\u1edbi nh\u1ea5t t\u1eeb Shohan, c\u00f3 g\u1ea7n 90.000 server ch\u1ea1y Memcached qua c\u1ed5ng 11211 \u0111ang m\u1edf. V\u00e0 r\u1ea5t nhi\u1ec1u trong s\u1ed1 \u0111\u00f3 \u0111\u1ebfn t\u1eeb c\u00e1c location th\u00f4ng d\u1ee5ng: M\u1ef9, Nh\u1eadt, H\u1ed3ng K\u00f4ng\u2026 C\u1ee5 th\u1ec3, c\u00e1c cu\u1ed9c t\u1ea5n c\u00f4ng x\u1ea3y ra kh\u1eafp n\u01a1i tr\u00ean to\u00e0n th\u1ebf gi\u1edbi, nh\u01b0ng ch\u1ee7 y\u1ebfu l\u00e0 B\u1eafc M\u1ef9 v\u00e0 Ch\u00e2u \u00c2u.<\/p>\n<p dir=\"ltr\"><strong>2. C\u00e0i \u0111\u1eb7t v\u00e0 b\u1ea3o m\u1eadt cho Memcached tr\u00ean CentOS7<\/strong><\/p>\n<ul>\n<li>C\u00e0i \u0111\u1eb7t Memcached<\/li>\n<\/ul>\n<p dir=\"ltr\">N\u1ebfu b\u1ea1n ch\u01b0a c\u00e0i \u0111\u1eb7t Memcached tr\u00ean m\u00e1y ch\u1ee7 c\u1ee7a m\u00ecnh, b\u1ea1n c\u00f3 th\u1ec3 c\u00e0i \u0111\u1eb7t n\u00f3 t\u1eeb kho ch\u00ednh th\u1ee9c CentOS. Tr\u01b0\u1edbc ti\u00ean, \u0111\u1ea3m b\u1ea3o r\u1eb1ng ch\u1ec9 m\u1ee5c g\u00f3i \u1ee9ng d\u1ee5ng c\u1ee7a b\u1ea1n \u0111\u01b0\u1ee3c c\u1eadp nh\u1eadt g\u00f5 ho\u1eb7c copy l\u1ec7nh\u00a0nh\u01b0 sau:<\/p>\n<p dir=\"ltr\"><strong><em>sudo yum update<\/em><\/strong><\/p>\n<p dir=\"ltr\">Ti\u1ebfp theo, c\u00e0i \u0111\u1eb7t g\u00f3i b\u1eb1ng c\u00e1ch g\u00f5 ho\u1eb7c copy l\u1ec7nh\u00a0nh\u01b0 sau:<\/p>\n<p dir=\"ltr\"><strong><em>sudo yum install memcached<\/em><\/strong><\/p>\n<p dir=\"ltr\">Ch\u00fang ta c\u00f3 th\u1ec3 c\u00e0i \u0111\u1eb7t libmemcached, m\u1ed9t th\u01b0 vi\u1ec7n cung c\u1ea5p m\u1ed9t s\u1ed1 cung c\u1ee5 \u0111\u1ec3 l\u00e0m vi\u1ec7c v\u1edbi m\u00e1y ch\u1ee7 memcached c\u1ee7a b\u1ea1n, G\u00f5 ho\u1eb7c copy l\u1ec7nh sau::<\/p>\n<p dir=\"ltr\"><em>s<strong>udo yum install libmemcached<\/strong><\/em><\/p>\n<p dir=\"ltr\">Memcached b\u00e2y gi\u1edd \u0111\u00e3 \u0111\u01b0\u1ee3c c\u00e0i \u0111\u1eb7t nh\u01b0 m\u1ed9t d\u1ecbch v\u1ee5 tr\u00ean m\u00e1y ch\u1ee7 c\u1ee7a b\u1ea1n, c\u0169ng v\u1edbi c\u00e1c c\u00f4ng c\u1ee5 cho ph\u00e9p b\u1ea1n ki\u1ec3m tra k\u1ebft n\u1ed1i c\u1ee7a n\u00f3. B\u00e2y gi\u1edd ch\u00fang ta c\u00f3 th\u1ec3 ti\u1ebfp t\u1ee5c c\u00e0i \u0111\u1eb7t c\u1ea5u h\u00ecnh<\/p>\n<ul dir=\"ltr\">\n<li>C\u1ea5u h\u00ecnh b\u1ea3o m\u1eadt\u00a0memcached<\/li>\n<\/ul>\n<p dir=\"ltr\">\u0110\u1ea7u ti\u00ean SSH v\u00e0o VPS v\u00e0 m\u1edf file config c\u1ee7a Memcached l\u00ean. G\u00f5 ho\u1eb7c copy l\u1ec7nh sau:<\/p>\n<p dir=\"ltr\"><strong>vi \/etc\/sysconfig\/memcached<\/strong><\/p>\n<p dir=\"ltr\">\u1ede ph\u1ea7n Options ta th\u00eam v\u00e0o\u00a0<strong>-l 127.0.0.1 -U 0<\/strong>\u00a0\u0111\u1ec3 ch\u1eb7n b\u0103ng th\u00f4ng b\u1eafn ra c\u0169ng nh\u01b0 ch\u1eb7n lu\u00f4n UDP<\/p>\n<p dir=\"ltr\">PORT=\"11211\"<br \/>USER=\"memcached\"<br \/>MAXCONN=\"10024\"<br \/>CACHESIZE=\"20\"<br \/>OPTIONS=\"-l 127.0.0.1 -U 0\"<\/p>\n<p dir=\"ltr\">L\u01b0u l\u1ea1i r\u1ed3i kh\u1edfi \u0111\u1ed9ng l\u1ea1i d\u1ecbch v\u1ee5. B\u1ea1n c\u0169ng ho\u00e0n to\u00e0n c\u00f3 th\u1ec3 t\u1ea3i File config v\u1ec1 m\u00e1y t\u00ednh, s\u1eeda sau \u0111\u00f3 up \u0111\u00e8 l\u00ean file config tr\u00ean server.: g\u00f5 ho\u1eb7c copy l\u1ec7nh\u00a0nh\u01b0 sau<\/p>\n<p dir=\"ltr\"><strong>service memcached restart<\/strong><\/p>\n<p dir=\"ltr\">Ki\u1ec3m tra l\u1ea1i b\u1eb1ng l\u1ec7nh<\/p>\n<p dir=\"ltr\"><strong>netstat -plunt<\/strong><\/p>\n<p dir=\"ltr\">Ta s\u1ebd th\u1ea5y UDP \u0111\u00e3 b\u1ecb \u0111\u00f3ng, Memcached ch\u1ec9 c\u00f2n ch\u1ea1y tr\u00ean TCP 11211 \u00a0m\u00e0 th\u00f4i<\/p>\n<p dir=\"ltr\"><em>Active Internet connections (only servers)<br \/>Proto Recv-Q Send-Q Local Address \u00a0\u00a0\u00a0Foreign Address State PID\/Program<br \/>tcp \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a00 0 127.0.0.1:11211 \u00a00.0.0.0:* LISTEN 2383\/memcache<\/em><\/p>\n<p dir=\"ltr\">Ch\u00fac c\u00e1c b\u1ea1n th\u00e0nh c\u00f4ng!<\/p>\n<p>&nbsp;<\/p>\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>H\u01b0\u1edbng d\u1eabn fix bug Memcached, ng\u0103n ch\u1eb7n DDoS Theo Arbor Networks, c\u00e1c truy v\u1ea5n gi\u1ea3 m\u1ea1o c\u0169ng h\u01b0\u1edbng \u0111\u1ebfn TCP c\u1ed5ng 11211, nh\u01b0ng v\u00ec c\u00e1c truy v\u1ea5n TCP kh\u00f4ng th\u1ec3 gi\u1ea3 m\u1ea1o n\u00ean c\u00e1ch t\u1ea5n c\u00f4ng n\u00e0y \u00edt b\u1ecb l\u1ea1m...<\/p>\n","protected":false},"author":27,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[40,71],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/cloud.z.com\/vn\/wp-json\/wp\/v2\/posts\/5101"}],"collection":[{"href":"https:\/\/cloud.z.com\/vn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloud.z.com\/vn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloud.z.com\/vn\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/cloud.z.com\/vn\/wp-json\/wp\/v2\/comments?post=5101"}],"version-history":[{"count":1,"href":"https:\/\/cloud.z.com\/vn\/wp-json\/wp\/v2\/posts\/5101\/revisions"}],"predecessor-version":[{"id":5102,"href":"https:\/\/cloud.z.com\/vn\/wp-json\/wp\/v2\/posts\/5101\/revisions\/5102"}],"wp:attachment":[{"href":"https:\/\/cloud.z.com\/vn\/wp-json\/wp\/v2\/media?parent=5101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloud.z.com\/vn\/wp-json\/wp\/v2\/categories?post=5101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloud.z.com\/vn\/wp-json\/wp\/v2\/tags?post=5101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}