{"id":69463,"date":"2024-07-03T22:26:42","date_gmt":"2024-07-03T14:26:42","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=69463"},"modified":"2024-07-03T22:26:42","modified_gmt":"2024-07-03T14:26:42","slug":"rhce-1","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/rhce-1.html","title":{"rendered":"\u5982\u4f55\u8bbe\u7f6e\u548c\u6d4b\u8bd5\u9759\u6001\u7f51\u7edc\u8def\u7531\uff1f"},"content":{"rendered":"
RHCE\uff08Red Hat Certified Engineer\uff0c\u7ea2\u5e3d\u8ba4\u8bc1\u5de5\u7a0b\u5e08\uff09\u662f\u7ea2\u5e3d\u516c\u53f8\u7684\u4e00\u4e2a\u8ba4\u8bc1\uff0c\u7ea2\u5e3d\u5411\u4f01\u4e1a\u793e\u533a\u8d21\u732e\u5f00\u6e90\u64cd\u4f5c\u7cfb\u7edf\u548c\u8f6f\u4ef6\uff0c\u540c\u65f6\u5b83\u8fd8\u7ed9\u516c\u53f8\u63d0\u4f9b\u8bad\u7ec3\u3001\u652f\u6301\u548c\u54a8\u8be2\u670d\u52a1\u3002<\/p>\n
<\/p>\n
\u5728 RHCE \u7684\u7b2c\u4e00\u548c\u7b2c\u4e8c\u90e8\u5206\uff0c\u6211\u4eec\u4f1a\u4ecb\u7ecd\u4e00\u4e9b\u57fa\u672c\u7684\u4f46\u5178\u578b\u7684\u60c5\u5f62\uff0c\u4e5f\u5c31\u662f\u9759\u6001\u8def\u7531\u539f\u7406\u3001\u5305\u8fc7\u6ee4\u548c\u7f51\u7edc\u5730\u5740\u8f6c\u6362\u3002<\/p>\n
<\/p>\n
\u8bf7\u6ce8\u610f\u6211\u4eec\u4e0d\u4f1a\u4f5c\u6df1\u5165\u7684\u4ecb\u7ecd\uff0c\u4f46\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u7ec4\u7ec7\u5185\u5bb9\u80fd\u5e2e\u52a9\u4f60\u5f00\u59cb\u7b2c\u4e00\u6b65\u5e76\u7ee7\u7eed\u540e\u9762\u7684\u5185\u5bb9\u3002<\/p>\n
\u6211\u4eec\u5728\u8be5\u7bc7\u6307\u5357\u4e2d\u4f1a\u8003\u8651\u4ee5\u4e0b\u573a\u666f\u3002\u6211\u4eec\u6709\u4e00\u53f0 RHEL 7\uff0c\u8fde\u63a5\u5230 1\u53f7\u8def\u7531\u5668 [192.168.0.1] \u4ee5\u8bbf\u95ee\u56e0\u7279\u7f51\u4ee5\u53ca 192.168.0.0\/24 \u4e2d\u7684\u5176\u5b83\u673a\u5668\u3002<\/p>\n
\u7b2c\u4e8c\u4e2a\u8def\u7531\u5668\uff082\u53f7\u8def\u7531\u5668\uff09\u6709\u4e24\u4e2a\u7f51\u5361\uff1aenp0s3 \u540c\u6837\u8fde\u63a5\u5230\u8def\u7531\u56681\u53f7\u4ee5\u8bbf\u95ee\u4e92\u8054\u7f51\uff0c\u53ca\u4e0e RHEL 7 \u548c\u540c\u4e00\u7f51\u7edc\u4e2d\u7684\u5176\u5b83\u673a\u5668\u901a\u8baf\uff0c\u53e6\u5916\u4e00\u4e2a\u7f51\u5361\uff08enp0s8\uff09\u7528\u4e8e\u6388\u6743\u8bbf\u95ee\u5185\u90e8\u670d\u52a1\u6240\u5728\u7684 10.0.0.0\/24 \u7f51\u7edc\uff0c\u4f8b\u5982 web \u6216\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002<\/p>\n
\u8be5\u573a\u666f\u53ef\u4ee5\u7528\u4e0b\u9762\u7684\u793a\u610f\u56fe\u8868\u793a\uff1a<\/p>\n
<\/p>\n
\u9759\u6001\u8def\u7531\u7f51\u7edc\u793a\u610f\u56fe<\/em><\/p>\n \u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\u6211\u4eec\u4f1a\u96c6\u4e2d\u4ecb\u7ecd\u5728 RHEL 7 \u4e2d\u8bbe\u7f6e\u8def\u7531\u8868\uff0c\u786e\u4fdd\u5b83\u80fd\u901a\u8fc71\u53f7\u8def\u7531\u5668\u8bbf\u95ee\u56e0\u7279\u7f51\u4ee5\u53ca\u901a\u8fc72\u53f7\u8def\u7531\u5668\u8bbf\u95ee\u5185\u90e8\u7f51\u7edc\u3002<\/p>\n \u5728 RHEL 7 \u4e2d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u7528ip \u547d\u4ee4\u914d\u7f6e\u548c\u663e\u793a\u8bbe\u5907\u548c\u8def\u7531\u3002\u8fd9\u4e9b\u66f4\u6539\u80fd\u5728\u8fd0\u884c\u7684\u7cfb\u7edf\u4e2d\u53ca\u65f6\u751f\u6548\uff0c\u4f46\u7531\u4e8e\u91cd\u542f\u540e\u4e0d\u4f1a\u4fdd\u5b58\uff0c\u6211\u4eec\u4f1a\u4f7f\u7528\/etc\/sysconfig\/network-scripts\u76ee\u5f55\u4e0b\u7684ifcfg-enp0sX\u548croute-enp0sX\u6587\u4ef6\u6c38\u4e45\u4fdd\u5b58\u6211\u4eec\u7684\u914d\u7f6e\u3002<\/p>\n \u9996\u5148\uff0c\u8ba9\u6211\u4eec\u6253\u5370\u51fa\u5f53\u524d\u7684\u8def\u7531\u8868\uff1a<\/p>\n <\/p>\n \u68c0\u67e5\u5f53\u524d\u8def\u7531\u8868<\/em><\/p>\n \u4ece\u4e0a\u9762\u7684\u8f93\u51fa\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u5f97\u51fa\u4ee5\u4e0b\u7ed3\u8bba\uff1a<\/p>\n \u4e0b\u9762\u662f\u8fd9\u6837\u7684\u914d\u7f6e\u4e2d\u4f60\u9700\u8981\u505a\u7684\u4e00\u4e9b\u5178\u578b\u4efb\u52a1\u3002\u9664\u975e\u53e6\u6709\u8bf4\u660e\uff0c\u4e0b\u9762\u7684\u4efb\u52a1\u90fd\u57282\u53f7\u8def\u7531\u5668\u4e0a\u8fdb\u884c\u3002<\/p>\n \u786e\u4fdd\u6b63\u786e\u5b89\u88c5\u4e86\u6240\u6709\u7f51\u5361\uff1a<\/p>\n \u5982\u679c\u6709\u67d0\u5757\u7f51\u5361\u505c\u7528\u4e86\uff0c\u542f\u52a8\u5b83\uff1a<\/p>\n \u5206\u914d 10.0.0.0\/24 \u7f51\u7edc\u4e2d\u7684\u4e00\u4e2a IP \u5730\u5740\u7ed9\u5b83\uff1a<\/p>\n \u5662\uff01\u6211\u4eec\u5206\u914d\u4e86\u4e00\u4e2a\u9519\u8bef\u7684 IP \u5730\u5740\u3002\u6211\u4eec\u9700\u8981\u5220\u9664\u4e4b\u524d\u5206\u914d\u7684\u90a3\u4e2a\u5e76\u6dfb\u52a0\u6b63\u786e\u7684\u5730\u5740\uff0810.0.0.18\uff09\uff1a<\/p>\n \u73b0\u5728\uff0c\u8bf7\u6ce8\u610f\u4f60\u53ea\u80fd\u6dfb\u52a0\u4e00\u4e2a\u901a\u8fc7\u7f51\u5173\u5230\u76ee\u6807\u7f51\u7edc\u7684\u8def\u7531\uff0c\u7f51\u5173\u9700\u8981\u53ef\u4ee5\u8bbf\u95ee\u5230\u3002\u56e0\u4e3a\u8fd9\u4e2a\u539f\u56e0\uff0c\u6211\u4eec\u9700\u8981\u5728 192.168.0.0\/24 \u8303\u56f4\u4e2d\u7ed9 enp0s3 \u5206\u914d\u4e00\u4e2a IP \u5730\u5740\uff0c\u8fd9\u6837\u6211\u4eec\u7684 RHEL 7 \u624d\u80fd\u8fde\u63a5\u5230\u5b83\uff1a<\/p>\n \u6700\u540e\uff0c\u6211\u4eec\u9700\u8981\u542f\u7528\u5305\u8f6c\u53d1\uff1a<\/p>\n \u5e76\u505c\u7528\/\u53d6\u6d88\u9632\u706b\u5899\uff08\u4ece\u73b0\u5728\u5f00\u59cb\uff0c\u76f4\u5230\u4e0b\u4e00\u7bc7\u6587\u7ae0\u4e2d\u6211\u4eec\u4ecb\u7ecd\u4e86\u5305\u8fc7\u6ee4\uff09\uff1a<\/p>\n \u56de\u5230\u6211\u4eec\u7684 RHEL 7\uff08192.168.0.18\uff09\uff0c\u8ba9\u6211\u4eec\u914d\u7f6e\u4e00\u4e2a\u901a\u8fc7 192.168.0.19\uff082\u53f7\u8def\u7531\u5668\u7684 enp0s3\uff09\u5230 10.0.0.0\/24 \u7684\u8def\u7531\uff1a<\/p>\n \u4e4b\u540e\uff0c\u8def\u7531\u8868\u770b\u8d77\u6765\u50cf\u4e0b\u9762\u8fd9\u6837\uff1a<\/p>\n <\/p>\n \u786e\u8ba4\u7f51\u7edc\u8def\u7531\u8868<\/em><\/p>\n \u540c\u6837\uff0c\u5728\u4f60\u5c1d\u8bd5\u8fde\u63a5\u7684 10.0.0.0\/24 \u7f51\u7edc\u7684\u673a\u5668\u4e2d\u6dfb\u52a0\u5bf9\u5e94\u7684\u8def\u7531\uff1a<\/p>\n \u4f60\u53ef\u4ee5\u4f7f\u7528 ping \u6d4b\u8bd5\u57fa\u672c\u8fde\u63a5\uff1a<\/p>\n \u5728 RHEL 7 \u4e2d\u8fd0\u884c\uff1a<\/p>\n 10.0.0.20 \u662f 10.0.0.0\/24 \u7f51\u7edc\u4e2d\u4e00\u4e2a web \u670d\u52a1\u5668\u7684 IP \u5730\u5740\u3002<\/p>\n \u5728 web \u670d\u52a1\u5668\uff0810.0.0.20\uff09\u4e2d\u8fd0\u884c<\/p>\n 192.168.0.18 \u4e5f\u5c31\u662f\u6211\u4eec\u7684 RHEL 7 \u673a\u5668\u7684 IP \u5730\u5740\u3002<\/p>\n \u53e6\u5916\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u4f7f\u7528tcpdump\uff08\u9700\u8981\u901a\u8fc7yum install tcpdump\u5b89\u88c5\uff09\u6765\u68c0\u67e5\u6211\u4eec RHEL 7 \u548c 10.0.0.20 \u4e2d web \u670d\u52a1\u5668\u4e4b\u95f4\u7684 TCP \u53cc\u5411\u901a\u4fe1\u3002<\/p>\n \u9996\u5148\u5728\u7b2c\u4e00\u53f0\u673a\u5668\u4e2d\u542f\u7528\u65e5\u5fd7\uff1a<\/p>\n \u5728\u540c\u4e00\u4e2a\u7cfb\u7edf\u4e0a\u7684\u53e6\u4e00\u4e2a\u7ec8\u7aef\uff0c\u8ba9\u6211\u4eec\u901a\u8fc7 telnet \u8fde\u63a5\u5230 web \u670d\u52a1\u5668\u7684 80 \u53f7\u7aef\u53e3\uff08\u5047\u8bbe Apache \u6b63\u5728\u76d1\u542c\u8be5\u7aef\u53e3\uff1b\u5426\u5219\u5e94\u5728\u4e0b\u9762\u547d\u4ee4\u4e2d\u4f7f\u7528\u6b63\u786e\u7684\u76d1\u542c\u7aef\u53e3\uff09\uff1a<\/p>\n tcpdump \u65e5\u5fd7\u770b\u8d77\u6765\u50cf\u4e0b\u9762\u8fd9\u6837\uff1a<\/p>\n <\/p>\n \u68c0\u67e5\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u7f51\u7edc\u8fde\u63a5<\/em><\/p>\n \u901a\u8fc7\u67e5\u770b\u6211\u4eec RHEL 7\uff08192.168.0.18\uff09\u548c web \u670d\u52a1\u5668\uff0810.0.0.20\uff09\u4e4b\u95f4\u7684\u53cc\u5411\u901a\u4fe1\uff0c\u53ef\u4ee5\u770b\u51fa\u5df2\u7ecf\u6b63\u786e\u5730\u521d\u59cb\u5316\u4e86\u8fde\u63a5\u3002<\/p>\n \u8bf7\u6ce8\u610f\u4f60\u91cd\u542f\u7cfb\u7edf\u540e\u4f1a\u4e22\u5931\u8fd9\u4e9b\u66f4\u6539\u3002\u5982\u679c\u4f60\u60f3\u628a\u5b83\u4eec\u6c38\u4e45\u4fdd\u5b58\u4e0b\u6765\uff0c\u4f60\u9700\u8981\u5728\u6211\u4eec\u8fd0\u884c\u4e0a\u9762\u7684\u547d\u4ee4\u7684\u76f8\u540c\u7cfb\u7edf\u4e2d\u7f16\u8f91\uff08\u5982\u679c\u4e0d\u5b58\u5728\u7684\u8bdd\u5c31\u521b\u5efa\uff09\u4ee5\u4e0b\u7684\u6587\u4ef6\u3002<\/p>\n \u5c3d\u7ba1\u5bf9\u4e8e\u6211\u4eec\u7684\u6d4b\u8bd5\u4f8b\u5b50\u4e0d\u662f\u4e25\u683c\u8981\u6c42\uff0c\u4f60\u9700\u8981\u77e5\u9053 \/etc\/sysconfig\/network \u5305\u542b\u4e86\u4e00\u4e9b\u7cfb\u7edf\u8303\u56f4\u7684\u7f51\u7edc\u53c2\u6570\u3002\u4e00\u4e2a\u5178\u578b\u7684 \/etc\/sysconfig\/network\u770b\u8d77\u6765\u7c7b\u4f3c\u4e0b\u9762\u8fd9\u6837\uff1a<\/p>\n \u5f53\u9700\u8981\u4e3a\u6bcf\u4e2a\u7f51\u5361\u8bbe\u7f6e\u7279\u5b9a\u7684\u53d8\u91cf\u548c\u503c\u65f6\uff08\u6b63\u5982\u6211\u4eec\u57282\u53f7\u8def\u7531\u5668\u4e0a\u9762\u505a\u7684\uff09\uff0c\u4f60\u9700\u8981\u7f16\u8f91\/etc\/sysconfig\/network-scripts\/ifcfg-enp0s3\u548c\/etc\/sysconfig\/network-scripts\/ifcfg-enp0s8\u6587\u4ef6\u3002<\/p>\n \u4e0b\u9762\u662f\u6211\u4eec\u7684\u4f8b\u5b50\uff0c<\/p>\n \u4ee5\u53ca<\/p>\n \u5176\u5206\u522b\u5bf9\u5e94 enp0s3 \u548c enp0s8\u3002<\/p>\n \u7531\u4e8e\u8981\u4e3a\u6211\u4eec\u7684\u5ba2\u6237\u7aef\u673a\u5668(192.168.0.18)\u8fdb\u884c\u8def\u7531\uff0c\u6211\u4eec\u9700\u8981\u7f16\u8f91\/etc\/sysconfig\/network-scripts\/route-enp0s3\uff1a<\/p>\n \u73b0\u5728reboot\u4f60\u7684\u7cfb\u7edf\uff0c\u5c31\u53ef\u4ee5\u5728\u8def\u7531\u8868\u4e2d\u770b\u5230\u8be5\u8def\u7531\u89c4\u5219\u3002<\/p>\n \u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\u6211\u4eec\u4ecb\u7ecd\u4e86\u7ea2\u5e3d\u4f01\u4e1a\u7248 Linux 7 \u7684\u9759\u6001\u8def\u7531\u3002\u5c3d\u7ba1\u573a\u666f\u53ef\u80fd\u4e0d\u540c\uff0c\u8fd9\u91cc\u4ecb\u7ecd\u7684\u4f8b\u5b50\u8bf4\u660e\u4e86\u6240\u9700\u7684\u539f\u7406\u4ee5\u53ca\u8fdb\u884c\u8be5\u4efb\u52a1\u7684\u6b65\u9aa4\u3002<\/p>\n \u5728\u4e0b\u7bc7\u6587\u7ae0\u4e2d\u6211\u4eec\u4f1a\u4ecb\u7ecd\u6570\u636e\u5305\u8fc7\u6ee4\u548c\u7f51\u7edc\u5730\u5740\u8f6c\u6362\uff0c\u7ed3\u675f RHCE \u9a8c\u8bc1\u9700\u8981\u7684\u7f51\u7edc\u57fa\u672c\u6280\u5de7\u3002<\/p>\n via: http:\/\/www.tecmint.com\/how-to-setup-and-configure-static-network-routing-in-rhel\/<\/a><\/p>\n \u4f5c\u8005\uff1aGabriel C\u00e1nepa<\/a> \u8bd1\u8005\uff1aictlyh<\/a> \u6821\u5bf9\uff1awxy<\/a><\/p>\n \u672c\u6587\u7531 LCTT<\/a> \u539f\u521b\u7ffb\u8bd1\uff0cLinux\u4e2d\u56fd<\/a> \u8363\u8a89\u63a8\u51fa<\/p>\n \u539f\u6587\u6765\u81ea\uff1ahttps:\/\/linux.cn\/article-6451-1.html<\/a><\/p>\n# ip route show\r\n<\/pre>\n
\n
# ip link show\r\n<\/pre>\n
# ip link set dev enp0s8 up\r\n<\/pre>\n
# ip addr add 10.0.0.17 dev enp0s8\r\n<\/pre>\n
# ip addr del 10.0.0.17 dev enp0s8\r\n# ip addr add 10.0.0.18 dev enp0s8\r\n<\/pre>\n
# ip addr add 192.168.0.19 dev enp0s3\r\n<\/pre>\n
# echo \"1\" > \/proc\/sys\/net\/ipv4\/ip_forward\r\n<\/pre>\n
# systemctl stop firewalld\r\n# systemctl disable firewalld\r\n<\/pre>\n
# ip route add 10.0.0.0\/24 via 192.168.0.19\r\n<\/pre>\n
# ip route show\r\n<\/pre>\n
# ip route add 192.168.0.0\/24 via 10.0.0.18\r\n<\/pre>\n
# ping -c 4 10.0.0.20\r\n<\/pre>\n
# ping -c 192.168.0.18\r\n<\/pre>\n
# tcpdump -qnnvvv -i enp0s3 host 10.0.0.20\r\n<\/pre>\n
# telnet 10.0.0.20 80\r\n<\/pre>\n
# Enable networking on this system?\r\nNETWORKING=yes\r\n# Hostname. Should match the value in \/etc\/hostname\r\nHOSTNAME=yourhostnamehere\r\n# Default gateway\r\nGATEWAY=XXX.XXX.XXX.XXX\r\n# Device used to connect to default gateway. Replace X with the appropriate number.\r\nGATEWAYDEV=enp0sX\r\n<\/pre>\n
TYPE=Ethernet\r\nBOOTPROTO=static\r\nIPADDR=192.168.0.19\r\nNETMASK=255.255.255.0\r\nGATEWAY=192.168.0.1\r\nNAME=enp0s3\r\nONBOOT=yes\r\n<\/pre>\n
TYPE=Ethernet\r\nBOOTPROTO=static\r\nIPADDR=10.0.0.18\r\nNETMASK=255.255.255.0\r\nGATEWAY=10.0.0.1\r\nNAME=enp0s8\r\nONBOOT=yes\r\n<\/pre>\n
10.0.0.0\/24 via 192.168.0.19 dev enp0s3\r\n<\/pre>\n
\n\n