Network Settings
From OpenSimulator
Dzonatas Sol (Talk | contribs) (→Issues with NAT and Port Forwarding) |
|||
Line 32: | Line 32: | ||
* Use an “ExternalAddress” of “somesimulator.somedomain.com” where you control the DNS for somedomain.com and can enter a “A Record” for ‘somesimulator.’ to your routers IP address. | * Use an “ExternalAddress” of “somesimulator.somedomain.com” where you control the DNS for somedomain.com and can enter a “A Record” for ‘somesimulator.’ to your routers IP address. | ||
* Create a “hosts” file (on windows, this is C:\Windows\System32\Drivers\etc\hosts and on Unix-type systems, this is /etc/hosts) entry on your internal client machines, for somesimulator.somedomain.com to your local LAN address for the simulator. | * Create a “hosts” file (on windows, this is C:\Windows\System32\Drivers\etc\hosts and on Unix-type systems, this is /etc/hosts) entry on your internal client machines, for somesimulator.somedomain.com to your local LAN address for the simulator. | ||
+ | |||
+ | === With iptables on Linux === | ||
+ | |||
+ | An easy way avoid a bounce-back setup on the router is to use iptables to redirect internal traffic. | ||
+ | |||
+ | * iptables -t nat -A OUTPUT --dst $EXTERNAL_IP -p tcp --dport 9000:9010 -j DNAT --to-destination $INTERNAL_IP | ||
+ | * iptables -t nat -A OUTPUT --dst $EXTERNAL_IP -p udp --dport 9000:9010 -j DNAT --to-destination $INTERNAL_IP | ||
+ | |||
+ | Those iptables lines will redirect any traffic going to $EXTERNAL_IP on ports 9000 to 9010 to $INTERNAL_IP. Use the above iptables command on all internal machines except your gateway/router. This assumes your gateway/router machine does not also host your sim. This also assume you have a default ACCEPT policy on your internal machines. | ||
== Further on Issues with NAT and Port Forwarding - example, using dyndns as a loopback == | == Further on Issues with NAT and Port Forwarding - example, using dyndns as a loopback == |
Revision as of 21:39, 8 February 2008
Network settings
OpenSim/Grid can be pretty tricky when it comes to setting it up on a private network this document covers what OpenSim needs in terms of network resources.
Ports used by OpenSim
OGS1 Grid Modes - Standard Port List
- TCP/8000 - Reserved
- TCP/8001 - Grid Server - Regions and other grid services talk to this
- TCP/8002 - User Server and Login Services - Clients, Regions, and other grid services talk to this
- TCP/8003 - Asset Services - Regions and other grid services talk to this
- TCP/8004 - Inventory Services - Regions and other grid services talk to this
- TCP/8005 - Reserved (Dispatch Services)
Simulators
- TCP/8895 - needed for region to region communications
- UDP+TCP/9000 - Default First Simulator - grid, regions, and clients talk to these
- UDP+TCP/9001 - Default Second Simulator - grid, regions, and clients talk to these
etc.
Note: If you use your simulator in standalone mode, it is enough to open the UDP+TCP/9000 on your firewall.
Issues with NAT and Port Forwarding
If your host does not have a public IP address (eg it is hidden behind a home router) you will have issues hosting grid and region servers if you plan on connecting clients to it on both sides of the router, however this can be worked around through very careful application of port forwarding and use of DNS host files. Please note this is not guarunteed to work (and is most likely to fail), it is highly recommended to have a internet accessible public static IP for the server which is hosting the regions.
Method:
- Set the simulator listening IP address to your public facing IP address (that of the router concerned)
- Port forward the above ports through to the simulator on both UDP and TCP.
- Use an “ExternalAddress” of “somesimulator.somedomain.com” where you control the DNS for somedomain.com and can enter a “A Record” for ‘somesimulator.’ to your routers IP address.
- Create a “hosts” file (on windows, this is C:\Windows\System32\Drivers\etc\hosts and on Unix-type systems, this is /etc/hosts) entry on your internal client machines, for somesimulator.somedomain.com to your local LAN address for the simulator.
With iptables on Linux
An easy way avoid a bounce-back setup on the router is to use iptables to redirect internal traffic.
- iptables -t nat -A OUTPUT --dst $EXTERNAL_IP -p tcp --dport 9000:9010 -j DNAT --to-destination $INTERNAL_IP
- iptables -t nat -A OUTPUT --dst $EXTERNAL_IP -p udp --dport 9000:9010 -j DNAT --to-destination $INTERNAL_IP
Those iptables lines will redirect any traffic going to $EXTERNAL_IP on ports 9000 to 9010 to $INTERNAL_IP. Use the above iptables command on all internal machines except your gateway/router. This assumes your gateway/router machine does not also host your sim. This also assume you have a default ACCEPT policy on your internal machines.
Further on Issues with NAT and Port Forwarding - example, using dyndns as a loopback
This method was used and successfully tested using www.dyndns.com (creates a virtual domain for your pc/ip, like yourcomputer.ath.cx) as loopback for devices on a LAN with three machines (pentium 2.8ghz running windows xp - internet server , amd opteron running ubuntu 7.10 64bit - as opensim server - and MacBook with OSX 10.4.11 - as client), a modem (thomson/alcatel speedtouch 330) and a mini-switch (which brand no one ever heard of). The connection of these machines is made as following: Modem -> Win Pc -> Switch -> Mac and Ubuntu. Dyndns is used to loopback to the Win Pc, and then it forwards the request to the internal LAN opensim server, which grants everything for the client. As for the client, if he is inside the private LAN then he is now actually someone on the internet requesting for access to the opensim server. Thus, if the client is someone on the internet then he will be treated like that. Tricky ? Further details ahead:
Method:
- Set the simulator listening IP address to your dyndns domain - edit opensim/bin/Regions/default.xml; and change the external_host_name to external_host_name="yourcomputer.ath.cx". Leave internal_ip_address "0.0.0.0" and port "9000".
- Set the client (SecondLife Viewer) -loginuri to "yourcomputer.ath.cx:8002" (the port used was 8002, yours can be different if you configured it that way) - i didnt used the -loginserver flag also.
- Port Forward the above ports on the internet server (in this case, win xp). You do so by creating exceptions in Windows Firewall for the above mentioned ports, and for both connections: Internet Connection and LAN - this keeps the ports open for the web requests to travel over the private network.
- Edit "hosts" file (on windows, this is C:\Windows\System32\Drivers\etc\hosts and on Unix-type systems, this is /etc/hosts) entry on your internet server (in this case, win xp box) and add the following line: xxx.xxx.xxx.xxx yourcomputer.ath.cx. Of course, xxx.xxx.xxx.xxx is your opensim server internal LAN IP.
yourcomputer.ath.cx is now available for everyone to connect and you may login with the client!
A solution for local connections if you have a ZyXEL DSL modem/router with NAT and Port Forwarding
This solution works with the ZyXEL Prestige 660ME-61 DSL Router. It may work with other models made by ZyXEL.
Method:
- Connect by TELNET to your ZyXEL DSL modem. Use the same IP address that you would if you were using the web interface. For example, the default ip on most Embarq ZyXEL DSL modems is 192.168.2.1.
telnet 192.168.2.1
- Enter your password. If you do not know it, try just pressing <ENTER> or ask your ISP for the password. They may or may not give it to you.
- Select menu option "24. System Maintenance" from the menu.
Copyright (c) 1994 - 2004 ZyXEL Communications Corp. Prestige 660ME-61 Main Menu Getting Started Advanced Management 1. General Setup 21. Filter Set Configuration 2. WAN Backup Setup 22. SNMP Configuration 3. LAN Setup 23. System Password 4. Internet Access Setup 24. System Maintenance 25. IP Routing Policy Setup Advanced Applications 26. Schedule Setup 11. Remote Node Setup 12. Static Routing Setup 15. NAT Setup 99. Exit Enter Menu Selection Number:
- Select menu option "8. Command Interpreter Mode" from the menu
Menu 24 - System Maintenance 1. System Status 2. System Information and Console Port Speed 3. Log and Trace 4. Diagnostic 5. Backup Configuration 6. Restore Configuration 7. Upload Firmware 8. Command Interpreter Mode 9. Call Control 10. Time and Date Setting 11. Remote Management Enter Menu Selection Number:
- At the prompt type "ip nat loopback on".
Copyright (c) 1994 - 2004 ZyXEL Communications Corp. Sprint > ip nat loopback on
- At the prompt type "exit".
Sprint> exit
- Select menu option "99. Exit"
- Follow all other steps for configuring and starting your server as outlined in Getting Started.
A Solution for local connections if you have the DLink GamerLounge Extreme N router
Networking and router configurations have been responsible for 98% of all trouble I have had setting up and operating OpenSimulator region server software. Insuring that you have a capable router properly configured should be the first thing on the list of configuration checkpoints for a smooth and trouble-free path to OpenSimulator software operations in GridMode.
Below is a series of screen snapshots with the key pages of my router configuration interface with proper settings displayed.
The settings below assume that you have an otherwise working connection and do not touch on such subjects as port conflicts or logging your network onto your ISP's provider network.
** your status page should resemble this except for embedded site-specific details **
- provided that all information supplied in ~opensim/bin/OpenSim.ini and in your ~opensim/Regions/*.xml are properly configured, this should have you up and running.
NOTE: Contrary to what is displayed above, DHCP services are not required to operate OpenSimulator server software.