0

I’ve got ethernet interface on FreeBSD 7.1 with 3 ip adresses binded to it.

# ifconfig

em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=19b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4>
ether 00:e0:81:b1:1b:4b
inet 89.xx.xx.1 netmask 0xfffffc00 broadcast 89.xx.xx.255
inet 89.xx.xx.2 netmask 0xffffffff broadcast 89.xx.xx.2
inet 89.xx.xx.3 netmask 0xffffffff broadcast 89.xx.xx.3
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active

How to launch php script binded to different ip adresses? I need this script to access one service from different ip addresses.

4

1 回答 1

1

If you want to set up a service at a specified IP-address, just fill in that address as the second parameter of the socket_bind function. If the IP address is varying depending on the situation, you can use a command line parameter to specify this address

If you want the script to use a specified IP address when connecting to a remote service, that is not easy. Since the internet stack on your computer determines which IP address will be used, depending on which network the destination is. And in your case all IP addresses are on the same network.
I think that you you should think in this situation whether it is really required to use a particular address...

于 2010-01-11T12:27:16.720 回答