{"id":1372,"date":"2026-07-09T00:35:22","date_gmt":"2026-07-08T15:35:22","guid":{"rendered":"https:\/\/www.ecoop.net\/memo\/?p=1372"},"modified":"2026-07-09T00:41:04","modified_gmt":"2026-07-08T15:41:04","slug":"netcat-udp-usage","status":"publish","type":"post","link":"https:\/\/www.ecoop.net\/memo\/archives\/netcat-udp-usage.html","title":{"rendered":"netcat(nc)\u3067UDP\u901a\u4fe1\u3059\u308b\u4f7f\u3044\u65b9\u307e\u3068\u3081(-u \u30aa\u30d7\u30b7\u30e7\u30f3\u3068BSD\/GNU\/RHEL\u7cfb\u7d71\u5225)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">nc(netcat)\u3067UDP\u901a\u4fe1\u3059\u308b\u306b\u306f <code>-u<\/code> \u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4ed8\u3051\u308b\u3060\u3051\u3067\u3059\u3002\u305f\u3060\u3057 nc \u306b\u306f\u5b9f\u88c5\u304c\u3044\u304f\u3064\u304b\u3042\u308a\u3001\u7279\u306b\u5f85\u3061\u53d7\u3051(<code>-l<\/code>)\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u66f8\u304d\u65b9\u304c\u7cfb\u7d71\u306b\u3088\u3063\u3066\u9055\u3044\u307e\u3059\u3002\u3053\u3053\u3092\u53d6\u308a\u9055\u3048\u308b\u3068\u30b3\u30de\u30f3\u30c9\u304c\u30a8\u30e9\u30fc\u306b\u306a\u3063\u305f\u308a\u3001\u610f\u56f3\u3068\u9055\u3046\u52d5\u304d\u3092\u3057\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3067\u306f\u57fa\u672c\u306e\u4f7f\u3044\u65b9\u3068\u3001\u7cfb\u7d71\u3054\u3068\u306e\u9055\u3044\u3092\u5b9f\u969b\u306b\u52d5\u304b\u3057\u3066\u78ba\u8a8d\u3057\u305f\u7d50\u679c\u3067\u307e\u3068\u3081\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u57fa\u672c:nc\u3067UDP\u3092\u9001\u53d7\u4fe1\u3059\u308b<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u964d\u306e\u57fa\u672c\u64cd\u4f5c\u306f\u3001macOS\u6a19\u6e96\u306enc(BSD\u7cfb\u3001OpenBSD nc\u7531\u6765)\u3067\u5b9f\u6a5f\u78ba\u8a8d\u3057\u305f\u30b3\u30de\u30f3\u30c9\u3067\u3059\u3002<code>-u<\/code> \u3067\u306e\u57fa\u672c\u7684\u306a\u9001\u53d7\u4fe1\u306f\u3069\u306e\u7cfb\u7d71\u3067\u3082\u540c\u3058\u3067\u3059\u304c\u3001\u5f85\u3061\u53d7\u3051(<code>-l<\/code>)\u307e\u308f\u308a\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u7cfb\u7d71\u3054\u3068\u306b\u5909\u308f\u308a\u307e\u3059\u3002\u8a73\u3057\u304f\u306f\u6b21\u306e\u7ae0\u306b\u307e\u3068\u3081\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<h4 class=\"wp-block-heading\">\u53d7\u4fe1\u5074(listen)<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">nc -u -l 1234\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6307\u5b9a\u3057\u305f\u30dd\u30fc\u30c8\u3067UDP\u30d1\u30b1\u30c3\u30c8\u306e\u5230\u7740\u3092\u5f85\u3061\u307e\u3059\u3002TCP\u3068\u9055\u3063\u3066\u300c\u63a5\u7d9a\u300d\u3068\u3044\u3046\u6982\u5ff5\u304c\u306a\u3044\u306e\u3067\u3001\u30d1\u30b1\u30c3\u30c8\u304c\u5c4a\u3044\u305f\u6642\u70b9\u3067\u5185\u5bb9\u304c\u305d\u306e\u307e\u307e\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u9001\u4fe1\u5074<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">echo \"hello\" | nc -u 127.0.0.1 1234\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b9b\u5148\u30db\u30b9\u30c8\u3068\u30dd\u30fc\u30c8\u306bUDP\u30d1\u30b1\u30c3\u30c8\u3092\u9001\u308a\u307e\u3059\u3002\u6a19\u6e96\u5165\u529b\u304b\u3089\u8aad\u3093\u3060\u5185\u5bb9\u304c\u305d\u306e\u307e\u307e\u30d1\u30b1\u30c3\u30c8\u306e\u4e2d\u8eab\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u53cc\u65b9\u5411\u306e\u3084\u308a\u53d6\u308a<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">nc \u306f\u6a19\u6e96\u5165\u51fa\u529b\u3092\u4f7f\u3046\u30d7\u30ed\u30b0\u30e9\u30e0\u306a\u306e\u3067\u3001\u53d7\u4fe1\u5074\u30fb\u9001\u4fe1\u5074\u306e\u4e21\u65b9\u3067\u624b\u5165\u529b\u3057\u306a\u304c\u3089\u30c1\u30e3\u30c3\u30c8\u306e\u3088\u3046\u306b\u3084\u308a\u53d6\u308a\u3067\u304d\u307e\u3059\u3002\u624b\u5143\u3067\u52d5\u304b\u3057\u3066\u78ba\u8a8d\u3057\u305f\u3068\u3053\u308d\u3001\u53d7\u4fe1\u5074\u306f\u6700\u521d\u306e\u30d1\u30b1\u30c3\u30c8\u3092\u53d7\u3051\u53d6\u3063\u305f\u6642\u70b9\u3067\u9001\u4fe1\u5143\u306e\u30a2\u30c9\u30ec\u30b9\u3092\u899a\u3048\u3001\u305d\u3053\u3078\u8fd4\u4fe1\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># \u53d7\u4fe1\u5074(\u3053\u306e\u307e\u307e\u4f55\u304b\u5165\u529b\u3059\u308b\u3068\u9001\u4fe1\u5074\u306b\u5c4a\u304f)\nnc -u -l 1234\n\n# \u9001\u4fe1\u5074(\u5148\u306b\u3053\u3053\u304b\u3089\u4f55\u304b\u9001\u3063\u3066\u304b\u3089)\nnc -u 127.0.0.1 1234\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5148\u306b\u9001\u4fe1\u5074\u304b\u3089\u4f55\u304b\u9001\u3063\u3066\u3044\u306a\u3044\u3068\u3001\u53d7\u4fe1\u5074\u306f\u8ab0\u306b\u8fd4\u4fe1\u3059\u308c\u3070\u3044\u3044\u304b\u5206\u304b\u3089\u305a\u4f55\u3082\u9001\u308c\u307e\u305b\u3093\u3002\u9806\u756a\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">-v(verbose)\u3067\u72b6\u6cc1\u3092\u78ba\u8a8d\u3059\u308b<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">nc -u -v -w1 127.0.0.1 1234\n<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Connection to 127.0.0.1 port 1234 [udp\/*] succeeded!\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u306f\u300c\u9001\u4fe1\u3067\u304d\u305f\u300d\u3053\u3068\u3092\u793a\u3059\u3060\u3051\u3067\u3001\u76f8\u624b\u304c\u5b9f\u969b\u306b\u53d7\u3051\u53d6\u3063\u305f\u3053\u3068\u306f\u4fdd\u8a3c\u3057\u307e\u305b\u3093\u3002UDP\u306f\u30b3\u30cd\u30af\u30b7\u30e7\u30f3\u30ec\u30b9\u306a\u306e\u3067\u3001\u30ed\u30fc\u30ab\u30eb\u3067\u30bd\u30b1\u30c3\u30c8\u306e\u5411\u304d\u5148\u3092\u8a2d\u5b9a\u3067\u304d\u305f\u6642\u70b9\u3067 &#8220;succeeded&#8221; \u3068\u8868\u793a\u3055\u308c\u307e\u3059\u3002\u30dd\u30fc\u30c8\u304c\u9589\u3058\u3066\u3044\u3066\u3082\u540c\u3058\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u51fa\u308b\u3053\u3068\u304c\u3042\u308b\u306e\u3067\u904e\u4fe1\u306f\u7981\u7269\u3067\u3059(\u8a73\u3057\u304f\u306f\u5f8c\u8ff0\u306e <code>-z<\/code> \u306e\u9805\u76ee\u3092\u53c2\u7167)\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">-w(\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8)\u306e\u6ce8\u610f\u70b9<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><code>-w\u79d2\u6570<\/code> \u306f\u63a5\u7d9a\u3084\u6a19\u6e96\u5165\u529b\u304c\u6307\u5b9a\u79d2\u6570\u30a2\u30a4\u30c9\u30eb\u3060\u3068\u5207\u65ad\u3059\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3059\u304c\u3001\u5f85\u3061\u53d7\u3051(<code>-l<\/code>)\u5074\u306b\u306f\u52b9\u304d\u307e\u305b\u3093\u3002<code>nc -u -l -w1 1234<\/code> \u3068\u3057\u3066\u3082\u3001\u53d7\u3051\u5074\u306f\u6c38\u4e45\u306b\u5f85\u3061\u7d9a\u3051\u307e\u3059\u3002<code>-w1<\/code> \u3092\u4ed8\u3051\u305f\u53d7\u4fe1\u5074\u3092\u8d77\u52d5\u3057\u30662.5\u79d2\u5f85\u3063\u3066\u3082\u7d42\u4e86\u3057\u306a\u3044\u3053\u3068\u3092\u624b\u5143\u3067\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u3055\u305b\u305f\u3044\u306e\u306f\u57fa\u672c\u7684\u306b\u9001\u4fe1\u5074\u3060\u3051\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">nc \u306b\u306f3\u3064\u306e\u7cfb\u7d71\u304c\u3042\u308b<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">nc \u3068\u3044\u3046\u540d\u524d\u306e\u30b3\u30de\u30f3\u30c9\u306f1\u3064\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u3088\u304f\u4f7f\u308f\u308c\u308b\u306e\u306f\u6b21\u306e3\u7cfb\u7d71\u3067\u3001\u5f85\u3061\u53d7\u3051\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u66f8\u304d\u65b9\u304c\u9055\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u7cfb\u7d71<\/th><th>\u4e3b\u306a\u5165\u624b\u7d4c\u8def<\/th><th>UDP\u5f85\u3061\u53d7\u3051\u306e\u66f8\u304d\u65b9<\/th><th><code>-p<\/code> \u306e\u610f\u5473<\/th><\/tr><\/thead><tbody><tr><td>OpenBSD nc<\/td><td>macOS\u6a19\u6e96\u30fb<code>netcat-openbsd<\/code>(Debian\/Ubuntu)<\/td><td><code>nc -u -l 1234<\/code><\/td><td>\u9001\u4fe1\u5143\u30dd\u30fc\u30c8\u306e\u6307\u5b9a(\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u7528)<\/td><\/tr><tr><td>GNU netcat(traditional)<\/td><td><code>netcat-traditional<\/code>(Debian)<\/td><td><code>nc -u -l -p 1234<\/code><\/td><td>\u5f85\u3061\u53d7\u3051\u30fb\u9001\u4fe1\u5143\u3068\u3082\u306b\u30ed\u30fc\u30ab\u30eb\u30dd\u30fc\u30c8\u306e\u6307\u5b9a<\/td><\/tr><tr><td>Nmap Ncat<\/td><td><code>nmap-ncat<\/code>(RHEL\u7cfb)\u30fbmacOS\u306f <code>brew install nmap<\/code>\u30fbWindows\u306f\u516c\u5f0f\u30b5\u30a4\u30c8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30e9\u307e\u305f\u306f\u5358\u4f53\u306e <code>ncat.exe<\/code><\/td><td><code>ncat -u -l 1234<\/code><\/td><td>\u9001\u4fe1\u5143\u30dd\u30fc\u30c8\u306e\u6307\u5b9a(<code>-l<\/code> \u3068\u4f75\u7528\u53ef)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u540c\u3058 <code>-p<\/code> \u3067\u3082\u7cfb\u7d71\u306b\u3088\u3063\u3066\u300c\u5f85\u3061\u53d7\u3051\u30dd\u30fc\u30c8\u306e\u6307\u5b9a\u306b\u4f7f\u3048\u308b\u304b\u300d\u304c\u5909\u308f\u308b\u306e\u304c\u6700\u5927\u306e\u843d\u3068\u3057\u7a74\u3067\u3059\u30021\u3064\u305a\u3064\u5b9f\u6a5f\u30fb\u516c\u5f0f\u30de\u30cb\u30e5\u30a2\u30eb\u3067\u78ba\u8a8d\u3057\u305f\u5185\u5bb9\u3092\u66f8\u304d\u307e\u3059\u3002Windows\u306b\u306f\u6a19\u6e96\u306e <code>nc<\/code> \u306f\u5b58\u5728\u3057\u307e\u305b\u3093\u304c\u3001\u4e0a\u8868\u306eNcat\u304c\u516c\u5f0f\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u4f53\u7cfb\u306fmacOS\/Linux\u3068\u5171\u901a\u306a\u306e\u3067\u3001\u3053\u306e\u7ae0\u306e\u5185\u5bb9\u304c\u305d\u306e\u307e\u307e\u4f7f\u3048\u307e\u3059(\u5c0e\u5165\u3068\u5b9f\u969b\u306e\u4f7f\u3044\u65b9\u306f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306e\u7ae0\u3067\u7d39\u4ecb\u3059\u308b\u5225\u8a18\u4e8b\u3078)\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">OpenBSD nc(macOS\u6a19\u6e96)<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">macOS\u6a19\u6e96\u306e <code>nc<\/code>(Apple\u304c\u30ab\u30b9\u30bf\u30e0\u3057\u305f\u7248)\u3067\u306f\u3001\u5f85\u3061\u53d7\u3051\u30dd\u30fc\u30c8\u306f\u4f4d\u7f6e\u5f15\u6570\u3067\u6307\u5b9a\u3057\u307e\u3059\u3002<code>-l<\/code> \u3068 <code>-p<\/code> \u3092\u540c\u6642\u306b\u4f7f\u3046\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ nc -u -l -p 1234\nnc: missing port with option -l\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u624b\u5143\u306emacOS\u3067\u8a66\u3059\u3068\u3053\u306e\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3057\u305f\u3002<code>nc -u -l 1234<\/code> \u306e\u3088\u3046\u306b\u4f4d\u7f6e\u5f15\u6570\u3067\u30dd\u30fc\u30c8\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u88dc\u8db3:\u7d14\u6b63\u306eOpenBSD\u7248nc(Debian\u306e <code>netcat-openbsd<\/code> \u30d1\u30c3\u30b1\u30fc\u30b8\u306a\u3069)\u306e\u516c\u5f0f\u30de\u30cb\u30e5\u30a2\u30eb\u3067\u306f\u3001<code>-l<\/code> \u306e\u5f85\u3061\u53d7\u3051\u30dd\u30fc\u30c8\u306f\u4f4d\u7f6e\u5f15\u6570\u3067\u3082 <code>-p<\/code> \u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3082\u3069\u3061\u3089\u3067\u3082\u6307\u5b9a\u3067\u304d\u308b\u3068\u8aac\u660e\u3055\u308c\u3066\u3044\u307e\u3059\u3002macOS\u306enc(Apple\u7248)\u306f\u3053\u306e\u70b9\u3067OpenBSD\u672c\u5bb6\u3088\u308a\u5236\u9650\u304c\u53b3\u3057\u304f\u3001<code>-p<\/code> \u3068 <code>-l<\/code> \u306e\u4f75\u7528\u3092\u8a31\u53ef\u3057\u3066\u3044\u307e\u305b\u3093\u3002\u540c\u3058\u300cOpenBSD nc\u300d\u3067\u3082\u914d\u5e03\u5143\u306b\u3088\u3063\u3066\u7d30\u90e8\u304c\u7570\u306a\u308b\u306e\u3067\u3001\u4f4d\u7f6e\u5f15\u6570\u3067\u66f8\u304f\u7656\u3092\u3064\u3051\u3066\u304a\u304f\u306e\u304c\u7121\u96e3\u3067\u3059\u3002<\/p>\n<\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\">GNU netcat(traditional)<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u3061\u3089\u306f\u9006\u306b <code>-p<\/code> \u3067\u306e\u6307\u5b9a\u304c\u57fa\u672c\u5f62\u3067\u3059\u3002\u516c\u5f0f\u30de\u30cb\u30e5\u30a2\u30eb\u306eSYNOPSIS\u306b\u306f\u6b21\u306e\u3088\u3046\u306b\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nc -l -p port [-options] [hostname] [port]\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">UDP\u3067\u5f85\u3061\u53d7\u3051\u308b\u306a\u3089\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nc -u -l -p 1234\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>-l 1234<\/code> \u306e\u3088\u3046\u306b\u4f4d\u7f6e\u5f15\u6570\u3060\u3051\u3067\u5f85\u3061\u53d7\u3051\u30dd\u30fc\u30c8\u3092\u6307\u5b9a\u3059\u308b\u53e4\u3044\u8a18\u4e8b\u3082\u3042\u308a\u307e\u3059\u304c\u3001GNU netcat(traditional)\u306e\u516c\u5f0f\u306a\u66f8\u304d\u65b9\u306f <code>-p<\/code> \u3092\u4f7f\u3046\u5f62\u3067\u3059\u3002\u624b\u5143\u306e\u74b0\u5883\u306bGNU netcat(traditional)\u304c\u7121\u3044\u305f\u3081\u5b9f\u6a5f\u3067\u306e\u52d5\u4f5c\u78ba\u8a8d\u306f\u3067\u304d\u3066\u3044\u307e\u305b\u3093\u3002\u4e0a\u8a18\u306fDebian\u306e\u516c\u5f0f\u30de\u30cb\u30e5\u30a2\u30eb\u30da\u30fc\u30b8\u3067\u78ba\u8a8d\u3057\u305f\u5185\u5bb9\u3067\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Nmap Ncat<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Ncat\u306f <code>-p<\/code>(<code>--source-port<\/code>)\u3092 <code>-l<\/code> \u3068\u7d44\u307f\u5408\u308f\u305b\u3066\u3082\u52d5\u304d\u307e\u3059\u3002\u8a66\u3057\u305f\u3068\u3053\u308d\u3001<code>ncat -u -l -p 1234<\/code> \u306f\u6b63\u5e38\u306b\u5f85\u3061\u53d7\u3051\u3092\u958b\u59cb\u3057\u3001\u30d1\u30b1\u30c3\u30c8\u3082\u53d7\u4fe1\u3067\u304d\u307e\u3057\u305f\u3002\u4f4d\u7f6e\u5f15\u6570\u3067\u306e\u6307\u5b9a(<code>ncat -u -l 1234<\/code>)\u3082\u540c\u69d8\u306b\u4f7f\u3048\u308b\u306e\u3067\u3001\u3069\u3061\u3089\u306e\u66f8\u304d\u65b9\u3067\u3082\u56f0\u308a\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ncat -u -l 1234\n# \u307e\u305f\u306f\nncat -u -l -p 1234\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u81ea\u5206\u306e nc \u304c\u3069\u306e\u7cfb\u7d71\u304b\u898b\u5206\u3051\u308b<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u307e\u305a <code>ncat --version<\/code> \u306e\u3088\u3046\u306b\u7cfb\u7d71\u540d\u5165\u308a\u3067\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u8868\u793a\u3057\u3066\u304f\u308c\u308b\u30b3\u30de\u30f3\u30c9\u306a\u3089\u305d\u308c\u3067\u4e00\u767a\u3067\u3059\u3002Ncat\u306f\u3053\u308c\u3067\u5206\u304b\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">nc(netcat)\u305d\u306e\u3082\u306e\u306b\u306f\u30d0\u30fc\u30b8\u30e7\u30f3\u8868\u793a\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u7121\u3044\u5b9f\u88c5\u304c\u591a\u3044\u306e\u3067\u3001\u6b21\u306e\u65b9\u6cd5\u3067\u898b\u5206\u3051\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Debian\/Ubuntu\u7cfb\u306a\u3089\u3001<code>readlink -f $(command -v nc)<\/code> \u3067 <code>nc<\/code> \u306e\u5b9f\u4f53\u306e\u30d1\u30b9\u3092\u78ba\u8a8d\u3057\u3001\u305d\u306e\u30d1\u30b9\u3092 <code>dpkg -S<\/code> \u306b\u6e21\u305b\u3070\u3069\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u63d0\u4f9b\u3057\u3066\u3044\u308b\u304b\u5206\u304b\u308a\u307e\u3059\u3002<code>netcat-openbsd<\/code> \u304b <code>netcat-traditional<\/code> \u306e\u3069\u3061\u3089\u304b\u304c\u51fa\u308b\u306f\u305a\u3067\u3059\u3002RHEL\/Fedora\u7cfb\u306a\u3089 <code>rpm -q nmap-ncat<\/code> \u3067\u5165\u3063\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002macOS\u306e <code>\/usr\/bin\/nc<\/code> \u306f\u5e38\u306bApple\u7248\u306eOpenBSD nc\u7cfb\u3067\u3001\u5225\u306b <code>ncat<\/code> \u30b3\u30de\u30f3\u30c9\u304c\u3042\u308c\u3070 <code>brew install nmap<\/code> \u3067\u5165\u308c\u305fNcat\u3067\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u3069\u3046\u3057\u3066\u3082\u5206\u304b\u3089\u306a\u3044\u3068\u304d\u306f\u3001\u672c\u8a18\u4e8b\u3067\u78ba\u8a8d\u3057\u305f <code>nc -u -l -p \u30dd\u30fc\u30c8\u756a\u53f7<\/code> \u3092\u8a66\u3059\u65b9\u6cd5\u3082\u3042\u308a\u307e\u3059\u3002\u30a8\u30e9\u30fc\u306b\u306a\u308c\u3070 macOS\u6a19\u6e96\u306enc\u7cfb\u7d71\u3001\u305d\u306e\u307e\u307e\u8d77\u52d5\u3059\u308c\u3070GNU netcat(traditional)\u304bNcat\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">-z \u3067\u30dd\u30fc\u30c8\u30b9\u30ad\u30e3\u30f3\u3059\u308b(\u304c\u3001UDP\u3067\u306f\u904e\u4fe1\u7981\u7269)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>-z<\/code> \u306f\u30c7\u30fc\u30bf\u3092\u9001\u3089\u305a\u306b\u63a5\u7d9a\u3060\u3051\u8a66\u3059\u300c\u30bc\u30edI\/O\u30e2\u30fc\u30c9\u300d\u3067\u3059\u3002TCP\u306e\u30dd\u30fc\u30c8\u30b9\u30ad\u30e3\u30f3\u3067\u306f\u5b9a\u756a\u3067\u3059\u304c\u3001UDP\u3067\u306f\u7cfb\u7d71\u306b\u3088\u3063\u3066\u6319\u52d5\u304c\u5927\u304d\u304f\u9055\u3046\u3053\u3068\u3092\u5b9f\u6a5f\u3067\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">macOS\u6a19\u6e96\u306enc(BSD\u7cfb)\u3067\u3001\u8ab0\u3082\u5f85\u3061\u53d7\u3051\u3066\u3044\u306a\u3044\u30dd\u30fc\u30c8\u5b9b\u3066\u306b <code>-z<\/code> \u3092\u5b9f\u884c\u3059\u308b\u3068\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ nc -u -z -v -w1 127.0.0.1 40000\nConnection to 127.0.0.1 port 40000 [udp\/*] succeeded!\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b9f\u969b\u306b\u4f55\u304b\u304c\u5f85\u3061\u53d7\u3051\u3066\u3044\u308b\u30dd\u30fc\u30c8\u306b\u5bfe\u3057\u3066\u3082\u7d50\u679c\u306f\u540c\u3058(succeeded\u3001\u7d42\u4e86\u30b3\u30fc\u30c90)\u3067\u3001\u958b\u3044\u3066\u3044\u308b\u304b\u9589\u3058\u3066\u3044\u308b\u304b\u3092\u533a\u5225\u3067\u304d\u307e\u305b\u3093\u3002UDP\u30d1\u30b1\u30c3\u30c8\u3092\u9001\u308a\u3063\u3071\u306a\u3057\u306b\u3057\u3066\u5fdc\u7b54\u3092\u5f85\u305f\u306a\u3044\u3060\u3051\u306a\u306e\u3067\u3001\u305d\u3082\u305d\u3082\u5224\u5b9a\u306e\u6750\u6599\u306b\u306a\u3063\u3066\u3044\u306a\u3044\u306e\u3067\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u65b9Ncat\u306f\u3001ICMP\u306e port unreachable \u3092\u5f85\u3063\u3066\u5224\u5b9a\u3059\u308b\u3076\u3093\u3001\u30ed\u30fc\u30ab\u30eb\u30eb\u30fc\u30d7\u30d0\u30c3\u30af\u3067\u306f\u958b\u3044\u3066\u3044\u308b\u30dd\u30fc\u30c8\u3068\u9589\u3058\u3066\u3044\u308b\u30dd\u30fc\u30c8\u3067\u7d50\u679c\u304c\u5909\u308f\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># \u8ab0\u3082\u5f85\u3061\u53d7\u3051\u3066\u3044\u306a\u3044\u30dd\u30fc\u30c8\n$ ncat -u -z -v -w1 127.0.0.1 40000\nNcat: Connection refused.\n\n# \u5f85\u3061\u53d7\u3051\u4e2d\u306e\u30dd\u30fc\u30c8\n$ ncat -u -z -v -w1 127.0.0.1 40001\nNcat: UDP packet sent successfully\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u305f\u3060\u3057\u3053\u308c\u306fICMP\u306e port unreachable \u304c\u305d\u306e\u307e\u307e\u5c4a\u304f\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3060\u304b\u3089\u3053\u305d\u5224\u5b9a\u3067\u304d\u3066\u3044\u307e\u3059\u3002\u5b9f\u969b\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u8d8a\u3057\u3067\u306f\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u304cICMP\u3092\u6b62\u3081\u3066\u3044\u308b\u3053\u3068\u304c\u591a\u304f\u3001Ncat\u3067\u3082\u300c\u5fdc\u7b54\u304c\u7121\u3044=\u9589\u3058\u3066\u3044\u308b\u300d\u3068\u65ad\u5b9a\u306f\u3067\u304d\u307e\u305b\u3093\u3002UDP\u306e\u758e\u901a\u78ba\u8a8d\u3092\u304d\u3061\u3093\u3068\u884c\u3044\u305f\u3044\u5834\u5408\u306f\u3001<code>-z<\/code> \u306e\u7d50\u679c\u3060\u3051\u306b\u983c\u3089\u305a\u6b21\u306e\u8a18\u4e8b\u3082\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><a href=\"\/memo\/archives\/udp-port-check.html\">UDP\u30dd\u30fc\u30c8\u304c\u958b\u3044\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3059\u308b\u65b9\u6cd5<\/a><\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb(2026\u5e74\u6642\u70b9)<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"># macOS: nc\u306f\u6a19\u6e96\u642d\u8f09\u3002ncat(Nmap Ncat)\u3092\u4f7f\u3044\u305f\u3044\u5834\u5408\nbrew install nmap\n\n# Debian\/Ubuntu: \u65e2\u5b9a\u306enc(OpenBSD\u7cfb)\nsudo apt install netcat-openbsd\n\n# Debian\/Ubuntu: GNU netcat(traditional)\u304c\u3069\u3046\u3057\u3066\u3082\u5fc5\u8981\u306a\u5834\u5408\nsudo apt install netcat-traditional\n\n# RHEL\/CentOS\/Rocky\/Alma\/Fedora\u7cfb: Ncat\nsudo dnf install nmap-ncat   # \u53e4\u3044\u74b0\u5883\u306f yum install nmap-ncat\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Windows\u3067\u306e\u624b\u9806\u306f\u5225\u8a18\u4e8b\u306b\u307e\u3068\u3081\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><a href=\"\/memo\/archives\/windows-udp-command.html\">Windows\u3067UDP\u901a\u4fe1\u30fb\u30dd\u30fc\u30c8\u78ba\u8a8d\u3092\u3059\u308b\u65b9\u6cd5<\/a><\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">\u5225\u306e\u30c4\u30fc\u30eb:socat<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">nc \u3088\u308a\u3055\u3089\u306b\u67d4\u8edf\u306b\u30bd\u30b1\u30c3\u30c8\u3092\u6271\u3044\u305f\u3044\u5834\u5408\u306f <code>socat<\/code> \u3068\u3044\u3046\u9078\u629e\u80a2\u3082\u3042\u308a\u307e\u3059\u3002UDP&#x2194;TCP\u5909\u63db\u3084SSL\u7d42\u7aef\u306a\u3069\u3001nc\u3067\u306f\u3067\u304d\u306a\u3044\u3053\u3068\u3082\u591a\u304f\u3053\u306a\u305b\u307e\u3059\u304c\u3001\u305d\u306e\u5206\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u8907\u96d1\u3067\u3059\u3002\u7528\u9014\u304c\u30b7\u30f3\u30d7\u30eb\u306a\u9001\u53d7\u4fe1\u30fb\u758e\u901a\u78ba\u8a8d\u3067\u3042\u308c\u3070\u3001\u307e\u305a\u306fnc(\u307e\u305f\u306fncat)\u3067\u5341\u5206\u3067\u3059\u3002socat\u306e\u8a73\u3057\u3044\u4f7f\u3044\u65b9\u306f\u672c\u8a18\u4e8b\u3067\u306f\u6271\u3044\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u3055\u3044\u3054\u306b<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>UDP\u901a\u4fe1\u305d\u306e\u3082\u306e\u306f <code>-u<\/code> \u3092\u4ed8\u3051\u308b\u3060\u3051\u3067\u96e3\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002\u30cf\u30de\u308a\u3069\u3053\u308d\u306f\u7cfb\u7d71\u3054\u3068\u306e <code>-l<\/code>\/<code>-p<\/code> \u306e\u66f8\u304d\u65b9\u306e\u9055\u3044\u3067\u3059\u3002<\/li>\n\n\n\n<li>macOS\u6a19\u6e96\u306enc\u306f <code>-l<\/code> \u3068 <code>-p<\/code> \u3092\u4f75\u7528\u3067\u304d\u306a\u3044\u306e\u3067\u4f4d\u7f6e\u5f15\u6570\u3067\u66f8\u304f\u3001GNU netcat(traditional)\u306f <code>-p<\/code> \u3067\u306e\u6307\u5b9a\u304c\u57fa\u672c\u3001Ncat\u306f\u3069\u3061\u3089\u3067\u3082\u52d5\u304f\u3001\u3068\u899a\u3048\u3066\u304a\u3051\u3070\u8ff7\u3044\u307e\u305b\u3093\u3002<\/li>\n\n\n\n<li>\u30dd\u30fc\u30c8\u304c\u958b\u3044\u3066\u3044\u308b\u304b\u306e\u78ba\u8a8d\u306f <code>-z<\/code> \u3060\u3051\u306b\u983c\u3089\u305a\u3001<a href=\"\/memo\/archives\/udp-port-check.html\">UDP\u30dd\u30fc\u30c8\u304c\u958b\u3044\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3059\u308b\u65b9\u6cd5<\/a>\u3082\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/li>\n\n\n\n<li>\u305d\u3082\u305d\u3082\u306e\u300c\u306a\u305ctelnet\u3067\u306f\u3060\u3081\u3067nc\u3092\u4f7f\u3046\u306e\u304b\u300d\u306f <a href=\"\/memo\/archives\/udp-connection-on-command-line.html\">\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u3067UDP\u901a\u4fe1\u3092\u8a66\u3059\u65b9\u6cd5<\/a> \u306b\u307e\u3068\u3081\u3066\u3044\u307e\u3059\u3002<\/li>\n\n\n\n<li>Windows\u3067\u306e\u5c0e\u5165\u3068PowerShell\u3067\u306e\u6271\u3044\u306f <a href=\"\/memo\/archives\/windows-udp-command.html\">Windows\u3067UDP\u901a\u4fe1\u30fb\u30dd\u30fc\u30c8\u78ba\u8a8d\u3092\u3059\u308b\u65b9\u6cd5<\/a> \u306b\u307e\u3068\u3081\u3066\u3044\u307e\u3059\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>nc(netcat)\u3067UDP\u901a\u4fe1\u3059\u308b\u306b\u306f -u \u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4ed8\u3051\u308b\u3060\u3051\u3067\u3059\u3002\u305f\u3060\u3057 nc \u306b\u306f\u5b9f\u88c5\u304c\u3044\u304f\u3064\u304b\u3042\u308a\u3001\u7279\u306b\u5f85\u3061\u53d7\u3051(-l)\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u66f8\u304d\u65b9\u304c\u7cfb\u7d71\u306b\u3088\u3063\u3066\u9055\u3044\u307e\u3059\u3002\u3053\u3053\u3092\u53d6\u308a\u9055\u3048\u308b\u3068\u30b3\u30de\u30f3\u30c9\u304c\u30a8\u30e9\u30fc\u306b\u306a\u3063\u305f &hellip; <a href=\"https:\/\/www.ecoop.net\/memo\/archives\/netcat-udp-usage.html\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">netcat(nc)\u3067UDP\u901a\u4fe1\u3059\u308b\u4f7f\u3044\u65b9\u307e\u3068\u3081(-u \u30aa\u30d7\u30b7\u30e7\u30f3\u3068BSD\/GNU\/RHEL\u7cfb\u7d71\u5225)<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[135,155],"tags":[162,161],"class_list":["post-1372","post","type-post","status-publish","format-standard","hentry","category-server","category-dev","tag-telnet","tag-udp"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts\/1372","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/comments?post=1372"}],"version-history":[{"count":2,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts\/1372\/revisions"}],"predecessor-version":[{"id":1377,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts\/1372\/revisions\/1377"}],"wp:attachment":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/media?parent=1372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/categories?post=1372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/tags?post=1372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}