连接到没有互联网的域名

时间:2018-03-28 06:54:10

标签: networking

我的计算机连接到我的工作区AD域,通过此连接,它可以访问互联网,也可以连接到位于该域的服务器,例如150.130.xxx.xxx。我想知道如何在禁用互联网连接的同时保持与服务器的连接,以便此计算机可以连接到服务器而不是互联网。有什么建议吗?

2 个答案:

答案 0 :(得分:0)

我找到了一种方法,将IP设置从“自动获取IP地址”更改为“使用以下IP地址”并为其提供机器的实际IP地址,然后将默认网关和首选DNS服务器保留为空。

enter image description here

答案 1 :(得分:0)

另一种解决方案是在您连接到网络后在cmd中执行#include <stdio.h> #include <stdlib.h> #define MAX_INVENTORY_SIZE 100 typedef struct { char item_Number[3]; char item_Name[20]; float item_Profit; float latest_Price; unsigned int stock; unsigned int total_Sold; struct InventoryItemType *next; } InventoryItemType; void MainMenu(); #if 0 void displayInventory(InventoryItemType *(*)); #else void displayInventory(InventoryItemType *,int); #endif #if 0 void addItem(InventoryItemType, int i); #else void addItem(InventoryItemType *); #endif int main() { int i=1; char selection; // NOTE/BUG: starting at 1 will leave item 0 undefined #if 0 int count=1; #else int count=0; #endif // better to do this with a stack array than pointers to malloc'ed items #if 0 InventoryItemType *inventoryItems[MAX_INVENTORY_SIZE] ; #else InventoryItemType inventoryItems[MAX_INVENTORY_SIZE] ; #endif #if 0 // NOTE/BUG: this will segfault because inventoryItems is undefined here inventoryItems[0]=NULL; #endif while (1) { MainMenu(); scanf(" %c", &selection); switch(selection) { case 'A' : #if 0 displayInventory(inventoryItems); #else displayInventory(inventoryItems,count); #endif break; case 'B' : case 'C' : #if 0 inventoryItems[count]= (InventoryItemType*)malloc(sizeof(InventoryItemType)); addItem(*inventoryItems[count], count); #else addItem(&inventoryItems[count]); count += 1; #endif continue; case 'D' : case 'E' : case 'F' : case 'G' : case 'H' : default : printf("Invalid\n" ); } printf("Bottom of code\n"); system("pause"); } } void MainMenu() { printf("A. Display Inventory\n"); printf("B. Display Sales\n"); printf("C. Add Item\n"); printf("D. Remove Item\n"); printf("E. Enter Shipment\n"); printf("F. Update Sales\n"); printf("G. Sort\n"); printf("H. Exit\n"); printf("Make a selection\n"); } #if 0 void displayInventory(InventoryItemType display) { int i; for(i=0; i<MAX_INVENTORY_SIZE; i++) { printf("Name:%s\n", display[i].item_Name); printf("Stock:%d\n", display[i].stock); printf("Price:%.2f\n", display[i].latest_Price); printf("Total Value:%.2f\n", (display[i].stock)*(display[i].latest_Price)); printf("\n"); } } void addItem(InventoryItemType display) { // NOTE/BUG: because this is passed by _value_ nothing will be retained // after function return printf("\nEnter details of item \n\n"); printf("Enter Item Name: \n"); scanf("%s", display.item_Name); printf("\nEnter Item no: \n"); scanf("%s", display.item_Number); printf("\nEnter Stock: \n"); scanf("%d", &display.stock); printf("\nPurchase Price: \n"); scanf("%f", &display.latest_Price); } #else void displayInventory(InventoryItemType *item,int count) { int i; for (i=0; i<count; i++, item++) { printf("Name:%s\n", item->item_Name); printf("Stock:%d\n", item->stock); printf("Price:%.2f\n", item->latest_Price); printf("Total Value:%.2f\n", (item->stock)*(item->latest_Price)); printf("\n"); } } void addItem(InventoryItemType *item) { printf("\nEnter details of item \n\n"); printf("Enter Item Name: \n"); scanf("%s", item->item_Name); printf("\nEnter Item no: \n"); scanf("%s", item->item_Number); printf("\nEnter Stock: \n"); scanf("%d", &item->stock); printf("\nPurchase Price: \n"); scanf("%f", &item->latest_Price); } #endif 。这将阻止互联网流量发送到您的路由器。这可能比你正在做的更简单 - 它基本上做同样的事情,但所有这一切都在一个小小的命令中。