看面試題的時候,看到這莫一道題
經過我的一番搜尋,咳咳發現大多都不正确,達不到效果,于是我覺得還是自己寫把
如何将本地80端口的請求轉發到8080端口,目前主機IP為192.168.133.126
[[email protected] ~]# iptables -t nat -A PREROUTING -d 192.168.133.126 -p tcp --dport 80 -j DNAT --to-des 192.168.133.126:8080
[[email protected] ~]# curl http://192.168.133.126:80
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/
loose.dtd"><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>你好</title>
</head>
<h1 align="center">歡迎通路jsp頁面!</h1>
<h2 align="center">歡迎通路jsp頁面!</h2>
實測可行
想要面試題的留個言把