Home > other >  How Linux static IP configuration can be used as a web server to external access! (urgent)
How Linux static IP configuration can be used as a web server to external access! (urgent)

Time:10-04

From unicom company have a static IP address as the server IP, the building Lord small white, have a few problems:
1, how to configure the network?
To China unicom to IP address, subnet mask, gateway, network cable without router, directly on the Linux host, has carried on the static IP configuration in Linux,
Don't know what to do so, right?
Method of 2, according to the above configuration, the server can access to the Internet, but through static IP other computer can't access this server


Whether cable directly connected to the host, or to a router?
External computer ping the host address, unable to access the target host,
How should I properly configured network?

CodePudding user response:

Is generally not recommended threw the server directly outside the network,
Outside the network, routers, switches, office network/server
Then on the router, do mapping: access to the public network address port 80, transferred to the server LAN IP web service port
And, you need to set up your server (iptables or firewalld) firewall to allow access to the web service port

In addition, one important point: under the condition of your Settings are correct, probably still unable to access, then basically is blocked by China unicom drop port 80, need to find their open port 80, validation method is very simple, the web port refers to 81, 81 if outside network access, is allied to intercept, access networks outside 81, still is the problem of your Settings,

CodePudding user response:

Outside the network, routers, switches, office network/server
Do the network access server IP configuration is dynamic or static, does this is equivalent to a network server using the server do?
When external access server web applications can access the client from the server IP right?

Before this way, the router a fixed network address assigned to the server, then the server to do port mapping to the Intranet server, will get less than the client IP problems, all access to the server address is 192.168.1.1

CodePudding user response:

I suspect that is a question of your code, the code to obtain the address of the server to send it and see

CodePudding user response:

Language is PHP. The server will send the default

reference Runnerchin reply: 3/f
I suspect that is a question of your code, the code to obtain the address of the server to send it and see it

I use the PHP language, distributing requests to the server will be $_SERVER to the server, the inside of the $_SERVER [' REMOTE_ADDR] is the client IP, but this IP is 192.168.1.1,
This code doesn't matter with me,

CodePudding user response:

$_SERVER not by the client to server, but it was the server server variables, exists in the server, the PHP get client remote IP can refer to the following code
 function getIP () {
If (getenv (' HTTP_CLIENT_IP)) {
$IP=getenv (' HTTP_CLIENT_IP ');
}
Elseif (getenv (' HTTP_X_FORWARDED_FOR)) {
$IP=getenv (' HTTP_X_FORWARDED_FOR ');
}
Elseif (getenv (' HTTP_X_FORWARDED)) {
$IP=getenv (' HTTP_X_FORWARDED ');
}
Elseif (getenv (' HTTP_FORWARDED_FOR)) {
$IP=getenv (' HTTP_FORWARDED_FOR ');
}
Elseif (getenv (' HTTP_FORWARDED)) {
$IP=getenv (' HTTP_FORWARDED ');
}
The else {
IP=$$_SERVER [' REMOTE_ADDR];
}
Return $IP;
}

CodePudding user response:

You see your Linux server firewall, isn't INPUT to DROP off
  • Related