RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

I need help with my IP

Rusty

Wanderer
I need help with my IP

I cant connect with the public IP and anybody cant connect throw internet, i dont have router or firewall, i´d tried all, but i still cant connect. i can connect with my private IP. What can i do? I tried with a DNS host but it doesnt works, and i have the ServerList.cs 2.0. I dont know what to do. if anybody can help i will appreciate.
 

Orbit Storm

Sorceror
Rusty said:
I cant connect with the public IP and anybody cant connect throw internet, i dont have router or firewall, i´d tried all, but i still cant connect. i can connect with my private IP. What can i do?

Ok, well.. you shouldn't really be able to connect through the Public IP anyways since thats more for the purpose of other users to connect to you :p
And you are saying that you can connect to your server with your Private IP.. right? But no one can connect to your server through the Public IP??
Well if thats the case... have you even tried adding a New Local Server on UOGateway? And if not you need to do so, I can help you with that. And as far as others connecting to your server, if you're not done with it, I wouldn't add it to the UOGateway server list just yet.. Answer these few questions and I can help you further :D
 

Rusty

Wanderer
i just want to connect throw the public IP to know if everybody can do it, i already done this before in another pc but that pc has a router and i can configure that but in this case i dont know what to do, i already pass my ip to some friends and they tried to connect but it freeze in the Connecting window. I can connect throw my local IP. What i have to do??
 

Orbit Storm

Sorceror
Rusty said:
i just want to connect throw the public IP to know if everybody can do it, i already done this before in another pc but that pc has a router and i can configure that but in this case i dont know what to do

I'm not quite sure if you can connect through your Public IP, I know I never could and I'm using a DSL Router....

Rusty said:
i already pass my ip to some friends and they tried to connect but it freeze in the Connecting window. What i have to do??

Go to this website www.whatismyip.com and double check the IP address.. make certain you're giving them this IP and the correct port number... :)


***Edit***
Just on after thought.. have you edited your ServerList.cs file?? And is your IP a Static IP (meaning remains the same) or is it Dynamic (changing) ???
 

Rusty

Wanderer
yes i give the correct IP but they cant connect, and you should can connect with you public IP because you are entering to your IP throw internet.
 

Orbit Storm

Sorceror
Rusty said:
yes i give the correct IP but they cant connect, and you should can connect with you public IP because you are entering to your IP throw internet.

Just in case you didn't catch my edited post:
Just on after thought.. have you edited your ServerList.cs file?? And is your IP a Static IP (meaning remains the same) or is it Dynamic (changing) ???

And another thing...I'm guessing you're using a Dial-Up Connection??
 

Orbit Storm

Sorceror
Rusty said:
I´ve a static IP and i already tried with no-Ip.com, but nothings works. I have DSL.

Have you configured your router correctly?? If you have DSL you most certainly have a router.. I'm gonna need the made and model number of your router.. it should be somewhere on the router itself.. and who is your internet provider?

In the meantime.. go to Start/Programs/Accessories/Command Prompt.... type in ipconfig at the prompt and use the Default Gateway number to connect to your Router.. just simply type in the number

Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 193.268.1.2
Subnet Mask . . . . . . . . . . . : 255.255.255.252
Default Gateway . . . . . . . . . : 195.868.1.1

You need to use the number in red.. type it into your browser's url bar and go to it.. you should have some form of documentation with a Username and Password should it require one, once you are there I will try to walk you through it.
 

Phantom

Knight
Rusty said:
I´ve a static IP and i already tried with no-Ip.com, but nothings works. I have DSL.

If you have a static ip, why would you use a dns service...

Your first post doesn't make sense, you claim it works if you use your "private" ip which means you must have a network.

Post the output of "ipconfig" then I can help you. Note to other users, unless you can help this person, don't reply your only confusing him more.
 

Rusty

Wanderer
Its in spanish, tell my if you doesnt understand

IPCONFIG:
Configuración IP de Windows


Adaptador Ethernet Conexión de área local :

Estado de los medios. . . .: medios desconectados

Adaptador Ethernet Conexión de área local 10 :

Sufijo de conexión específica DNS :
Dirección IP de autoconfiguración : 169.254.155.154
Máscara de subred . . . . . . . . : 255.255.0.0
Puerta de enlace predeterminada :

Adaptador PPP speedy :

Sufijo de conexión específica DNS :
Dirección IP. . . . . . . . . . . : 168.226.147.13
Máscara de subred . . . . . . . . : 255.255.255.255
Puerta de enlace predeterminada : 168.226.147.13
 

Orbit Storm

Sorceror
***Note To Other Users***

I am trying to walk him through this step-by-step... a whole hell of a lot slower than what 2 guys I know by the names of Phantom and Thraxus ever did ;) :p
 

Rusty

Wanderer
here it is

// ==================================================================================================
// ServerList.cs
// ==================================================================================================
// 1.0 RunUO Beta 36 Initial version
// 1.1 Mr Fixit Now automaticly detects if you are connecting localy and uses the
// servers local ip in the client serverlist.
// 1.2 Mr Fixit Internet IP autodetection using www.whatismyip.com.
// 1.3 Mr Fixit If script fails to find the internet ip, keep the old one and try
// again in # minutes.
// 1.4 Mr Fixit You can now add AutoIP mirrors. Added whatismyip.com and myip.com.
// 1.5 Mr Fixit Adjusted the AutoIP mirror engine so it supports more mirrors.
// Added findmyip.com and ipaddy.com.
// 1.6 Mr Fixit IP is now trimmed (Just in case). Added simflex.com, edpsciences.com,
// ipid.shat.net and checkip.dyndns.org.
// 1.7 Mr Fixit Removed www.whatismyip.com is it seems to be out of buisness.
// 1.8 Mr Fixit Added a message to the console with ServerList.cs version when server loads.
// Now detects the internet ip when the server starts.
// Now checks if the ip has changed every 60 minutes instead of 30 minutes.
// 1.9 Mr Fixit Removed noip.com mirror as it isnt working anymore.
// 2.0 Mr Fixit Now only renews the ip every 24 hours (1440 minutes).
// ==================================================================================================

using System;
using System.Net;
using System.Net.Sockets;
using Server;
using Server.Network;

namespace Server.Misc
{
public class ServerList
{

// ==================================================================================
// YOUR SERVERS NAME
// ==================================================================================
public const string ServerName = "RunUO Test Center";

// ==================================================================================
// YOUR INTERNET IP OR DNS NAME
// Here you can select to autodetect your internet ip, or manualy specify
// Examples:
// public static string Address = "12.34.56.78";
// public static string Address = "shard.host.com";
// ==================================================================================
public const bool InternetIPAutodetect = true;
public const int MinutesBetweenIPAutodetect = 1440;
public static string Address = null;

// ==================================================================================
// Here are some values stored
// ==================================================================================
private static LocalLanIPRange[] LocalLanIPRanges = new LocalLanIPRange[10];
private static UInt32 LocalLanIPRangesCount;
private static AutoIPMirror[] AutoIPMirrors = new AutoIPMirror[10];
private static UInt32 AutoIPMirrorsCount;
private static DateTime InternetIPAutodetectLast;


// ==================================================================================
// Initialization
// ==================================================================================
public static void Initialize()
{
// ----------------------------------------------------
// Select what port to use
// ----------------------------------------------------
Listener.Port = 2593;

// ----------------------------------------------------
// Load the local LAN ip ranges
// ----------------------------------------------------
AddLocalLANIPRange("10.0.0.0", "10.255.255.255");
AddLocalLANIPRange("192.168.0.0", "192.168.255.255");
AddLocalLANIPRange("172.16.0.0", "172.32.255.255");
AddLocalLANIPRange("169.254.0.0", "169.254.255.255");

// ----------------------------------------------------
// Load the Auto IP mirros
// ----------------------------------------------------
AddAutoIPMirror("http://www.findmyip.com/", "Your IP address is:<br>", "</FONT>");
AddAutoIPMirror("http://www.ipaddy.com/", "Your IP address is: ", "<br>");
AddAutoIPMirror("http://checkip.dyndns.org/", "Current IP Address: ", "</body>");
AddAutoIPMirror("http://ipid.shat.net/iponly/", "<title>", "</title>");
AddAutoIPMirror("http://www.edpsciences.com/htbin/ipaddress", "Your IP address is <B> ", " </B>");
AddAutoIPMirror("http://www2.simflex.com/ip.shtml", "Your IP address is <BR>", "<BR>");

// ----------------------------------------------------
// Create the event
// ----------------------------------------------------
EventSink.ServerList += new ServerListEventHandler( EventSink_ServerList );

// ----------------------------------------------------
// Show info in console
// ----------------------------------------------------
Console.WriteLine("Serverlist.cs: 2.0");

// ----------------------------------------------------
// Lets find internet ip
// ----------------------------------------------------
DetectInternetIP();


}


// ==================================================================================
// Add a range of local lan ips
// ==================================================================================
private static void AddLocalLANIPRange(string RangeFrom, string RangeTo)
{
LocalLanIPRanges[LocalLanIPRangesCount] = new LocalLanIPRange();
LocalLanIPRanges[LocalLanIPRangesCount].RangeFrom = StringIPToUInt32IP(RangeFrom);
LocalLanIPRanges[LocalLanIPRangesCount].RangeTo = StringIPToUInt32IP(RangeTo);
LocalLanIPRangesCount = LocalLanIPRangesCount + 1;
}


// ==================================================================================
// Convert a ip string to a binary unsigned int
// ==================================================================================
private static UInt32 StringIPToUInt32IP(string addr)
{
byte[] byteArray1 = IPAddress.Parse(addr).GetAddressBytes();
byte[] byteArray2 = IPAddress.Parse(addr).GetAddressBytes();
byteArray1[0] = byteArray2[3];
byteArray1[1] = byteArray2[2];
byteArray1[2] = byteArray2[1];
byteArray1[3] = byteArray2[0];
return BitConverter.ToUInt32( byteArray1, 0);
}


// ==================================================================================
// Used to store the local lan ip ranges
// ==================================================================================
private class LocalLanIPRange
{
public UInt32 RangeFrom;
public UInt32 RangeTo;
}


// ==================================================================================
// Add a AutoIP mirror
// ==================================================================================
private static void AddAutoIPMirror(string sURL, string sStart, string sEnd)
{
AutoIPMirrors[AutoIPMirrorsCount] = new AutoIPMirror();
AutoIPMirrors[AutoIPMirrorsCount].sURL = sURL;
AutoIPMirrors[AutoIPMirrorsCount].sStart = sStart;
AutoIPMirrors[AutoIPMirrorsCount].sEnd = sEnd;
AutoIPMirrorsCount = AutoIPMirrorsCount + 1;
}


// ==================================================================================
// Used to store the Auto IP mirrors
// ==================================================================================
private class AutoIPMirror
{
public string sURL;
public string sStart;
public string sEnd;
public UInt32 iFailures;
}


// ==================================================================================
// Detect ip
// ==================================================================================
public static void DetectInternetIP()
{

// ----------------------------------------------------
// Autodetect the Internet IP
// ----------------------------------------------------
if (InternetIPAutodetect) {
DateTime UpdateTime = InternetIPAutodetectLast;
UpdateTime = UpdateTime.AddMinutes(MinutesBetweenIPAutodetect);
if (UpdateTime<DateTime.Now) {
string NewAddress = null;
NewAddress = FindInternetIP();
InternetIPAutodetectLast = DateTime.Now;
if (NewAddress!=null)
{
Address = NewAddress;
}
}
}

}

// ==================================================================================
// The serverlist event
// ==================================================================================
public static void EventSink_ServerList( ServerListEventArgs e )
{
try
{

// ----------------------------------------------------
// Lets find internet ip
// ----------------------------------------------------
DetectInternetIP();

// ----------------------------------------------------
// Find the server ip to use for this user
// ----------------------------------------------------
IPAddress ipAddr = FindMachineIP(e);

// ----------------------------------------------------
// Send serverlist
// ----------------------------------------------------
if (ipAddr != null)
{
e.AddServer( ServerName, new IPEndPoint( ipAddr, Listener.Port ) );
} else {
e.Rejected = true;
}
}
catch
{
e.Rejected = true;
}
}


// ==================================================================================
// Connects to a webserver that gives you your internet ip
// ==================================================================================
public static string FindInternetIP( )
{

// ----------------------------------------------------
// Pick a random mirror
// ----------------------------------------------------
Random rnd = new Random();
int UseMirror = (int)( rnd.NextDouble() * AutoIPMirrorsCount);
string MyIP = "";

// ----------------------------------------------------
// Catch if the mirror is down
// ----------------------------------------------------
try
{
// ----------------------------------------------------
// Get the webpage
// ----------------------------------------------------
WebClient client = new WebClient();
byte[] pageData = client.DownloadData(AutoIPMirrors[UseMirror].sURL);
MyIP = System.Text.Encoding.ASCII.GetString(pageData);

// ----------------------------------------------------
// Find the string
// ----------------------------------------------------
int iStart = MyIP.LastIndexOf(AutoIPMirrors[UseMirror].sStart);
int iEnd = MyIP.IndexOf(AutoIPMirrors[UseMirror].sEnd, iStart+AutoIPMirrors[UseMirror].sStart.Length);
MyIP = MyIP.Substring(iStart+AutoIPMirrors[UseMirror].sStart.Length, iEnd-iStart-AutoIPMirrors[UseMirror].sStart.Length );
MyIP = MyIP.Trim();

// ----------------------------------------------------
// Return value
// ----------------------------------------------------
Console.WriteLine("Internet IP: {0} ({1})", MyIP, AutoIPMirrors[UseMirror].sURL);
return MyIP;
}
catch
{
Console.WriteLine("Unable to autoupdate the Internet IP from {0}!", AutoIPMirrors[UseMirror].sURL);
Console.WriteLine("----------------------------------------------------------------------");
Console.WriteLine(MyIP);
Console.WriteLine("----------------------------------------------------------------------");
return null;
}
}


// ==================================================================================
// Calculates what server IP to use
// ==================================================================================
public static IPAddress FindMachineIP( ServerListEventArgs e )
{
// ----------------------------------------------------
// Find the IP of the connecting user
// ----------------------------------------------------
Socket sock = e.State.Socket;
IPAddress theirAddress = ((IPEndPoint)sock.RemoteEndPoint).Address;
IPAddress serverAddress;

// ----------------------------------------------------
// Is it Loopback?
// ----------------------------------------------------
if ( IPAddress.IsLoopback( theirAddress ) )
{
return IPAddress.Parse( "127.0.0.1" );
}

// ----------------------------------------------------
// Local
// ----------------------------------------------------
UInt32 uint32Address = StringIPToUInt32IP(theirAddress.ToString());
for (UInt32 LocalLanIPRangesLoop = 0 ; LocalLanIPRangesLoop < LocalLanIPRangesCount; LocalLanIPRangesLoop++)
{
if ( (LocalLanIPRanges[LocalLanIPRangesLoop].RangeFrom <= uint32Address) && (LocalLanIPRanges[LocalLanIPRangesLoop].RangeTo >= uint32Address) )
{
Resolve(Dns.GetHostName(), out serverAddress);

Console.WriteLine("Player is reconnecting to " + serverAddress.ToString());
return serverAddress;
}
}

// ----------------------------------------------------
// Internet addresses
// ----------------------------------------------------
if (Address!=null)
{
Resolve(Address, out serverAddress);
} else {
Resolve(Dns.GetHostName(), out serverAddress);
}

Console.WriteLine("Player is reconnecting to " + serverAddress.ToString());
return serverAddress;
}


// ==================================================================================
// Resolves dns names
// ==================================================================================
public static bool Resolve( string addr, out IPAddress outValue )
{
try
{
outValue = IPAddress.Parse( addr );
return true;
}
catch
{
try
{
IPHostEntry iphe = Dns.Resolve( addr );

if ( iphe.AddressList.Length > 0 )
{
outValue = iphe.AddressList[iphe.AddressList.Length - 1];
return true;
}
}
catch
{
}
}
outValue = IPAddress.None;
return false;
}

}
}
 

Orbit Storm

Sorceror
Rusty said:
Its in spanish, tell my if you doesnt understand

IPCONFIG:

:D Actually I do... 5 years of Spanish from Junior high and HS not to mention another 6 in college :p

Here is your translation:



IP Configuration of IP Ethernet Adapter:

Ethernet adapter; Connection of local area:
State of means. . .: disconnected means <--- Honestly no clue wtf that means, my trans.)

Suffix of specific connection DNS:
Direction of IP autoconfiguration: 169.254.155.154
Subread Mask: 255.255.0.0
Predetermined connection access: (or port or door)


Adapter PPP Speedy:

Suffix of specific DNS connection:
Direction IP: 168.226.147.13
Subread Mask: 255.255.255.255
Predetermined connection access(or port/door): 168.226.147.13


Now thats a simple literal translation.. Some of it doesn't make much sense, but maybe Phantom can make more sense of it for you.. dunno :p
 

Orbit Storm

Sorceror
Also... if anyone would have checked right above this thread.. there is one describing some of the steps to configure your router.. which Rusty obviously has one:
http://www.runuo.com/forum/showthread.php?t=2068

Here is the info if you don't wish to use the link: :p


Configuring your Router:
You will almost certianly need to make a change in the router. If that is not possible, you may be out of luck. For a home network, try connecting to your router with your web browser. The address of the router will be displayed as the Gateway in the ipconfig or winipcfg command shown above. As an example if your local IP address is 192.168.1.n the router address is most likely 192.168.1.1. If it asks for a password, try admin or 1234. You will need to find the Port Forwarding section of the router configuration and forward TCP port 2593 to the local (private) IP address of your RunUO server. At the end of this article are notes and specific instructions for various routers.

Editing the ServerList.cs File:
Next you need to edit the ServerList.cs file on your server. If you have a Static IP, the change is easy and will only need to be done once. If your address is Dynamic you will need to update this file each time it changes unless you have chosen to use a DNS Name for your Server. Using Notepad (or your C# editor of choice) browse to your RunUO folder then to Scripts\Misc and open ServerList.cs. There are 2 lines like so?


Code:
public const string Address = null; public const string ServerName = "RunUO Test Center";​


The lines you are looking for are just as listed. The ones which start with / or * are comments and will have no effect if they are changed. On the first of the two lines replace the null with your Public IP address or your DNS Name -- whichever you use be sure to enclose it in quotes and end it with a semicolon.


Code:
public const string Address = "206.206.206.206";​

--or--

Code:
public const string Address = "myOwnWorld.no-ip.com";​


Where "myOwnWorld.no-ip.com" is the DNS Name you acquired, and/or "206.206.206.206" is the IP address of your router (public IP, not private.) The "RunUO Test Center" on the second of the two lines is the name of your shard which you can change to something a little more in tune with the shard you wish to run.
 

Phantom

Knight
Also... if anyone would have checked right above this thread.. there is one describing some of the steps to configure your router.. which Rusty obviously has one:

He doesn't have a router, based on the output of ipconfig.
 

Rusty

Wanderer
It Displays 3 of them:
Address: 127.0.0.1:2593
Address: 169.254.155.154:2593
Address: 168.226.153.209:2593
and i repeat I DONT HAVE A ROUTER
 

Phantom

Knight
Rusty said:
It Displays 3 of them:
Address: 127.0.0.1:2593
Address: 169.254.155.154:2593
Address: 168.226.153.209:2593
and i repeat I DONT HAVE A ROUTER

Do you have two connections or something?

Explain your connection...
 
Top